Skip to content
  • Official
  • Beginner
  • English
  • 11 steps · 2 quizzes

Correlation vs Causation: An Interactive Lesson

A correlation vs causation lesson: reveal a hidden confounder, shift a time series, mine noise for false hits and see why experiments randomise.

  • Free
  • No account needed
  • Stop any time, pick up where you left off
Workshopy.io

WorkshopyOfficial

78 lessons · used by 2 teachers

For teachers

Teaching this? Run it live with your class.

  • Students join with a code — no accounts
  • See who’s done and who’s stuck, step by step
  • It’s your copy — change anything before class

Sign in to copy it to your workspace. It’s free.

Your path

11 steps · 2 quizzes · open any step, or read it here

  1. Start here: do more meetings ship more features?Start hereThis correlation vs causation lesson starts with a chart every team meets sooner or later: teams that hold more meetings also ship more features. Should every team meet more?InteractiveHands-on
    Read this step

    This correlation vs causation lesson starts with a chart every team meets sooner or later: teams that hold more meetings also ship more features. Should every team meet more? Two numbers that rise together are a correlation; whether one causes the other is a different question, and the data alone often can't answer it.

    Interactive · Do more meetings ship more features? The question this lesson answers — try it in the lesson

    You just watched a strong trend come apart: once the dots are coloured by team size, the trend inside each group is flat, and a third variable turns out to drive both numbers. By the end of this lesson you'll know how to look for that third variable, and the other ways a correlation can mislead.

    What you'll do

    • Move a scatter plot from no link to a perfect one and read its r
    • Reveal a hidden third variable and watch a strong trend disappear
    • Search pure noise until it shows a "significant" correlation
    • Run the same experiment two ways, by choice and by coin flip, and compare the answers

    By the end you can

    • name the four usual reasons two numbers move together without one causing the other
    • explain why experiments assign at random
    • weigh a causal claim when no experiment is possible

    Everything runs in the lesson: a browser is all you need.

  2. Correlation: two numbers that move togetherTwo numbers are correlated when knowing one tells you something about the other: high values of one tend to come with high values of the other (a positive correlation), or with low values (a negative one).InteractiveHands-on
    Read this step

    Two numbers are correlated when knowing one tells you something about the other: high values of one tend to come with high values of the other (a positive correlation), or with low values (a negative one).

    The usual measure is Pearson's correlation coefficient, r. It runs from −1 to +1:

    • the sign gives the direction: + means up together, − means one goes up as the other goes down;
    • the size gives how close the dots sit to a straight line: 1 is a perfect line, 0 is no straight-line link at all.

    Squaring it gives r², the share of the variation in one number that a straight line through the other accounts for. An r of 0.7 sounds high, but r² is 0.49: the line accounts for about half the spread, and the other half is something else.

    Try it: drag the slider from 0.7 to 1, then to 0, then to −0.7. Press New sample of 40 a few times at 0.3.

    Interactive · Move the link from none to perfect and read r — try it in the lesson

    With only 40 dots, the same true link gives a slightly different r in every sample. A weak r in a small sample can be chance alone, which the step on searching for patterns comes back to.

    Takeaway: r says how tightly two numbers follow a straight line and in which direction. It says nothing about why.

  3. Same r, different stories: always look at the plotIn 1973 the statistician Francis Anscombe published four small data sets with the same mean of x, the same mean of y, the same best-fit line and the same correlation, r ≈ 0.82. Plotted, they look nothing alike. They are known as Anscombe's quartet.InteractiveHands-on
    Read this step

    In 1973 the statistician Francis Anscombe published four small data sets with the same mean of x, the same mean of y, the same best-fit line and the same correlation, r ≈ 0.82. Plotted, they look nothing alike. They are known as Anscombe's quartet.

    Try it: press Set I to Set IV and watch the dots move while every number below stays the same.

    Interactive · Anscombe's quartet: four data sets, one r — try it in the lesson

    What r misses:

    • Curves. r measures straight-line links only. Data on a perfect U-shape can have r = 0.
    • Outliers. One unusual point can raise or lower r a long way, or create a correlation on its own.
    • Groups. A cloud made of separate groups can show a strong r that no group has inside it. That is the next step.

    Takeaway: never report an r without looking at the scatter plot behind it.

  4. The hidden third variable: a confounderA confounder is a third variable that affects both numbers you are comparing. It makes them move together even when neither one has any effect on the other. The classic example: ice cream sales and drownings rise and fall together over the year.InteractiveHands-on
    Read this step

    A confounder is a third variable that affects both numbers you are comparing. It makes them move together even when neither one has any effect on the other.

    The classic example: ice cream sales and drownings rise and fall together over the year. Ice cream doesn't cause drowning. Hot weather sends more people to buy ice cream AND more people into the water. Temperature is the confounder.

    At work it looks like the chart from the start of the lesson. Each dot below is a team (illustrative data): meetings a week across, features shipped a month up.

    Try it: press Colour by team size, then Fit a line inside each group. Then move the slider to zero and back.

    Interactive · Meetings and features: reveal the hidden third variable — try it in the lesson

    Large teams hold more meetings and also ship more features, because they have more people. Among teams of the same size, the meeting count tells you nothing about output. Comparing like with like, within each group of the suspected confounder, is called stratifying or controlling for it. A regression model with team size as a variable does the same job with many variables at once.

    Two warnings:

    • You can only control for a confounder you have measured. The ones nobody thought to record stay hidden.
    • Controlling can reverse a comparison, not just remove it. The Data Literacy Training lesson shows a case of that, called Simpson's paradox.

    Takeaway: before you read a correlation as cause and effect, ask what third variable could drive both, and compare within its levels.

  5. A filter can create a correlation: selectionSometimes the pattern comes from who ended up in the data. If people (or products, or companies) are only included when they pass a filter, the filter itself can create a correlation that doesn't exist in the full population.InteractiveHands-on
    Read this step

    Sometimes the pattern comes from who ended up in the data. If people (or products, or companies) are only included when they pass a filter, the filter itself can create a correlation that doesn't exist in the full population. This is called selection bias, and this particular form is known as Berkson's paradox.

    Below, 200 applicants (illustrative data) take a technical test and an interview. Across all of them, the two scores are unrelated. The company hires the applicants with the best total of both.

    Try it: move the slider down to 20% hired, then turn on Show only the people hired.

    Interactive · A hiring filter creates a correlation — try it in the lesson

    Among the people hired, a strong test score goes with a weaker interview, simply because a hire with a weak score on one side needed a strong score on the other to pass. Ask the hiring managers and they may tell you "the brilliant engineers can't interview". Their data says so; the population doesn't.

    The same thing happens with restaurants that survive (great food or a great location), customers who answered a survey, and patients who reached a hospital.

    Takeaway: ask who was filtered into the data and how. A filter that depends on both numbers can create a correlation between them.

  6. Check: reading r, confounders and selectionFour quick questions. Answer from what you saw in the blocks.Quiz · 4 questions
    Read the questions

    Four quick questions. Answer from what you saw in the blocks.

    Question 1. A data set has r = 0. What can you conclude?

    • The two variables have nothing to do with each other
    • There is no straight-line link; a curved link is still possible
    • One variable causes the other to stay the same
    • The sample is too small

    Question 2. Which correlation shows the strongest link?

    • r = 0.5
    • r = 0.3
    • r = −0.8
    • r = 0.05

    Question 3. Ice cream sales and drownings rise and fall together over the year. What is the most likely explanation?

    • Eating ice cream before swimming causes drowning
    • Drownings make people buy ice cream
    • Hot weather increases both
    • It is pure chance

    Question 4. In all applicants, test and interview scores are unrelated. Among people hired, they are negatively correlated. Why?

    • Hiring makes people worse at interviews
    • The company hired on the total, so a weak score had to be made up by a strong one
    • The test and the interview measure the same thing
    • Hired people are a random sample of applicants
  7. Which way does the arrow point: reverse causationSometimes X and Y are linked, but the cause runs the other way: Y causes X. This is reverse causation. A manager sees that in the weeks the incident tool gets the most logins, the systems have the most outages, and wonders whether the tool is somehow to blame.InteractiveHands-on
    Read this step

    Sometimes X and Y are linked, but the cause runs the other way: Y causes X. This is reverse causation.

    A manager sees that in the weeks the incident tool gets the most logins, the systems have the most outages, and wonders whether the tool is somehow to blame. Look at when each happens.

    Try it: slide the purple line one week at a time and watch r for each shift.

    Interactive · Outages and incident tool logins: which comes first? — try it in the lesson

    The logins follow the outages by about a week: teams open the tool to write up what broke. In the same week there is almost no link at all. Timing is the first clue to direction: a cause comes before its effect.

    Other reverse-causation traps from work:

    • Accounts with a dedicated account manager cancel more often (the risky accounts were the ones given a manager).
    • People who use a help article more often report more problems (the problems sent them there).

    Timing helps but doesn't prove direction. Both could follow a third event, and some effects feed back on their causes (sales grow, so marketing spend grows, so sales grow).

    Takeaway: ask which came first. If you can't tell, the arrow could point either way.

  8. Search enough numbers and something correlates: chanceThe last ordinary explanation is chance. Two unrelated numbers measured a few times can line up by luck. A test at the usual 5% level is built so that, when there is no real link, about 1 comparison in 20 still looks "significant".InteractiveHands-on
    Read this step

    The last ordinary explanation is chance. Two unrelated numbers measured a few times can line up by luck. A test at the usual 5% level is built so that, when there is no real link, about 1 comparison in 20 still looks "significant".

    That's fine for one planned comparison. It breaks down when you compare everything with everything. A dashboard of 30 weekly metrics has 435 pairs. Even if none is related to any other, about 22 pairs will pass the 5% test.

    Try it: press New random data a few times, then move the slider from 5 metrics to 40.

    Interactive · Search a dashboard of pure noise for correlations — try it in the lesson

    This is the multiple comparisons problem, the same one the A/B testing lesson meets when a test checks many metrics. Websites collect absurd examples on purpose, such as a country's cheese consumption tracking deaths from tangled bedsheets year by year. They are found by searching thousands of series until two happen to match.

    Defences:

    • Decide the comparison before you look at the data, and write it down.
    • Count how many comparisons were made, and correct for them (the Bonferroni correction divides the 5% by that number).
    • Test the pattern again on new data. A chance pattern rarely repeats.

    Takeaway: a striking correlation found by searching many numbers is expected by chance. Ask how many were searched.

  9. Why experiments randomiseIf confounders, selection and reverse causation all come from how X got its value, the fix is to set X yourself, at random. That's a randomised controlled trial, the method behind A/B tests and clinical trials.InteractiveHands-on
    Read this step

    If confounders, selection and reverse causation all come from how X got its value, the fix is to set X yourself, at random. That's a randomised controlled trial, the method behind A/B tests and clinical trials.

    Below, 40 sales reps (illustrative) can take a training course. Experienced reps (purple) sell more anyway. When reps choose for themselves, the experienced ones sign up far more often.

    Try it: with the true effect at 0, press Run 100 times with Reps choose. Then switch to Flip a coin and run 100 times again. Then set the true effect to 6 and repeat.

    Interactive · Who takes the course: choice or a coin flip — try it in the lesson

    When reps choose, the course group is full of experienced reps, and the estimate shows an effect of about 9 deals that the course doesn't have. With a coin flip, experience ends up split about evenly, and so does everything else, measured or not, including variables nobody thought of. The estimates scatter by chance around the true effect, and the scatter shrinks with larger groups.

    What randomising buys:

    • Confounders: balanced on average, even the unmeasured ones.
    • Reverse causation: impossible, since the coin decided X before Y happened.
    • Chance: still there, but measurable. That's what a p-value and a sample-size plan are for.

    Takeaway: assigning at random is the only way to make the groups alike in everything except the thing you are testing.

  10. Name the explanationYou now have five possible readings of a correlation: a confounder, reverse causation, chance, selection, and good causal evidence. Try it: for each claim below, pick the explanation that fits best. A wrong pick tells you what to ask next.InteractiveHands-on
    Read this step

    You now have five possible readings of a correlation: a confounder, reverse causation, chance, selection, and good causal evidence.

    Try it: for each claim below, pick the explanation that fits best. A wrong pick tells you what to ask next.

    Interactive · Name the explanation for each claim — try it in the lesson

    When a claim lands on your desk, run the same check in your head: a third variable, the direction, how many things were searched, who was filtered in, and whether anyone assigned X at random.

    Takeaway: most "X drives Y" claims from observational data have at least one ordinary alternative. Name it before you act on the claim.

Comments

You’ll sign in with Google before it’s posted.Comments are public — don’t name your students.
0 / 1,500

No comments yet. Be the first to say how it went.

Using it

Workshopy shares this lesson under CC BY 4.0. Anyone may use and change it, with credit to you. Anyone can learn it here, free. A copy in your workspace is yours to change and run live; your students never need an account.

Versions

  1. 1

    Version 1Current

    · First published

Copies are made from the current version. A copy you already have doesn’t change.

More from Workshopy

All 78 lessons
All 21 Data & AI lessons