Saltar al contenido

Lección 18 · Reasoning with Data

Correlation and Causation

Learn what correlation measures, why it does not prove cause, how confounders and reverse causation work, and how randomized experiments help test causes.

Ice cream sales and swimming accidents tend to rise and fall together. Ice cream does not cause accidents. Warm weather increases both. This example is simple, but the same mistake appears in business meetings and news stories every day, in much less obvious forms. This lesson shows how to tell a pattern apart from a cause.

What correlation means

Two variables are associated if knowing one tells you something about the other. Correlation usually refers to a measure of how closely two numeric variables follow a straight line. The most common one is Pearson's r, which ranges from -1 to +1:

  • near +1: as one goes up, the other tends to go up, close to a line;
  • near -1: as one goes up, the other tends to go down;
  • near 0: little straight-line relationship.

Correlation does not tell you how steep the line is, and a strong curved relationship can have an r near zero.

Python Compute correlations

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The curve is perfectly predictable but gives r = 0. One extreme point can create a strong correlation almost alone. Always plot the data before trusting a number.

Why a correlation can appear

A and B move together

A causes B
B causes A
C causes both
1 / 2
  1. A causes B. More water, more plant growth (within limits).
  2. B causes A (reverse causation). Neighborhoods with more police may have more crime because police are sent where crime is high.
  3. A third factor C causes both. This is a confounder. Weather drives ice cream and swimming. Company size may drive both software spending and revenue.
  4. Chance. If you compare enough pairs of variables, some will match by luck.
  5. Shared trends over time. Any two things that grow steadily over the years will correlate, even if unrelated.
  6. Selection. If you only look at a filtered group, the filtering itself can create or hide a relationship.
Python A hidden third factor

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

All data here is simulated. Across all days, the two look strongly linked. Comparing days with similar temperature removes most of the link. This is called controlling for or holding constant the confounder. It only works for confounders you know about and measure.

Experiments

A randomized controlled experiment assigns people or items to groups by chance. One group gets the change (the treatment) and the other does not (the control). Because assignment is random, the groups tend to be similar in both known and unknown ways. A difference larger than chance would easily explain can then be linked to the change. In business this is often called an A/B test.

Good experiments also:

  • decide the main measure and sample size in advance;
  • run both groups at the same time;
  • keep everything else the same;
  • where possible, use a placebo or blinding so expectations do not affect results.

The A/B testing lesson explains the statistics.

When you cannot experiment

Sometimes experiments are impractical or unethical: you cannot randomly assign people to smoke. Researchers then use observational evidence, and confidence grows when several things line up:

  • the cause comes before the effect;
  • the link is strong and repeats in different settings;
  • more exposure goes with more effect (a dose-response pattern);
  • there is a plausible mechanism;
  • alternative explanations have been checked.

None of these alone proves cause, but together they can build a strong case.

Questions to ask

  1. Could the effect be causing the "cause"?
  2. What third factor could drive both?
  3. Was there a control group, and how were groups chosen?
  4. How many comparisons were tried?
  5. Does the effect size matter in practice?

A worked business case

An online course provider notices that learners who use the discussion forum finish the course far more often than those who do not. A manager proposes forcing everyone to post.

Think through the explanations. Perhaps the forum helps people finish. Perhaps motivated learners both post and finish, so motivation is a confounder. Or learners who last longer in the course have more chances to post, which is reverse causation. A forced post would only help if the forum itself causes completion.

A better test is to invite a randomly chosen half of new learners to join a forum activity and compare completion in the two groups as a whole, including those who ignored the invitation. That keeps the groups comparable. If completion is similar, the original pattern was probably driven by who chose to post. If it is clearly higher in the invited group, you have much better evidence that the invitation helps.

Practice

For each pattern, suggest an explanation other than "A causes B". People who carry lighters have lung disease more often. Towns with more hospitals record more illness. Children with bigger shoe sizes read better.

Answers: smoking is a likely confounder for lighters and lung disease. Towns with more hospitals may simply have more people, and more places where illness gets diagnosed and recorded; it is also possible that hospitals were built where illness was common. For shoes and reading, age is the obvious confounder, since older children have bigger feet and more practice with reading. In each case, think about what data you would need to check your idea.

Avoid both extremes. "Correlation does not imply causation" does not mean correlation is useless. It is a reason to investigate. Likewise, do not claim a cause from before-and-after numbers alone, since other things may have changed at the same time.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Fires attended by more firefighters tend to have more damage. Which explanation is most likely?

    Fire size is a confounder that affects both.
  2. 2. Why does random assignment help show cause?

    Known and unknown differences tend to be spread evenly between groups.
  3. 3. A correlation r is close to zero. What can you conclude?

    Pearson's r measures straight-line association only. Plot the data.
  4. 4. Sales rose after a new logo launched. What is a reasonable conclusion?

    A before-and-after comparison without a control cannot isolate the cause.

Summary

  • Correlation describes how variables move together, mostly in a straight line.
  • Links can come from cause, reverse cause, confounders, chance, trends or selection.
  • Plot data, because r can hide curves and outliers.
  • Randomized experiments are the strongest test of cause.
  • Without experiments, build evidence from several directions.

Next: Common Reasoning Traps

Tu progreso se guarda en este navegador. No necesitas una cuenta.