Stop 04 · Probability & StatisticsTopics · 6/9

Correlation vs Causation

Part of the Machine Learning Roadmap

In short

Two numbers rising together is exciting. It's also the most common trap in all of data work. Before you say 'X causes Y', check what else might be pushing both.

Two variables moving together does not mean one causes the other: a hidden third factor or pure chance can explain it. ML models happily use correlations, so you must be careful when claiming a feature drives an outcome.

The jaadu in the rain holds chai, looking puzzled at piles of umbrellas and cups.

Think of it like this

Umbrellas and chai in the monsoon

In July, umbrella sales and hot chai sales both shoot up. Do umbrellas make people thirsty for chai? No. The rain drives both. That hidden third factor is called a confounder, and it's behind many misleading correlations.

Watch it happen

The hidden third factor

Monsoon rain
Umbrella sales
Chai sales

1/4You see umbrella and chai sales move together. Correlation looks strong.

The big ideas

What you need to know

Correlation measures moving together

A coefficient near +1 or -1 means a strong linear link. It says nothing about why.

Look for confounders

Ask what could drive both variables: season, city size, income, time.

Reverse causation

Maybe Y causes X. Happy users use the app more, rather than usage making them happy.

Experiments show cause

Randomised tests like A/B tests are the most reliable way to show one thing causes another.

Save yourself the pain

Common mistakes

Oops

Writing 'users who use feature X spend 2x more, so feature X increases spend'.

Do this instead

Write 'are associated with'. Heavy spenders may simply explore more features. Test it to know.

Oops

Ignoring timing and season.

Do this instead

Check if both variables simply follow the calendar, like festive season or exam months.

Your mission

Find a spurious link

~20 min

Quick check

Cities with more hospitals have more deaths. What's the most likely explanation?

Go deeper

  1. 1Find a spurious correlation example online and name the hidden factor.
  2. 2Compute a correlation matrix with pandas .corr() and pick out one pair that is probably not causal.
  3. 3Practise phrasing results as 'is associated with' rather than 'causes'.

Also part of these roadmaps

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge