Skip to content
Grad Coach

Diagram · CC BY 4.0

Example: Correlation vs causation

Hot weather drives both ice cream sales and drownings; the two are correlated, and neither causes the other.

A causal diagram of a confounder, using the standard example that ice cream sales and drownings rise together. Hot weather, the confounder (Z), causes both: solid arrows run from it to ice cream sales (X) and to drownings (Y), the arrows labeled "More people buy ice cream" and "More people go swimming". There is no causal arrow between ice cream sales and drownings; they are joined only by a dotted orange line, labeled "Correlated but neither causes the other", for the correlation that appears in the data. A key names the two line types: solid arrow, causes; dotted line, correlation with no causal link.

Swipe sideways to see the whole diagram, or download the PNG.

Confounding variable - hot weather, ice cream sales and drownings. Derek Jansen, Grad Coach, CC BY 4.0.

What it shows

The drawing is a causal diagram of a confounder, built on a classic classroom example: ice cream sales and drownings rise and fall together. Hot weather (Z) causes both. More people buy ice cream (X), and more people go swimming, so drownings (Y) rise.

There is no causal arrow between ice cream sales and drownings. They are joined only by a dotted line for the correlation that appears in the data. Çetinkaya-Rundel and Hardin (2024, section 2.2.1) reason the same way about outside temperature, ice cream sales and boating accidents, and define a confounding variable as one associated with both of the variables being compared.

How to read it

  1. Solid arrows mean “causes”. Follow them out from hot weather to both of the other boxes.

  2. The dotted line between X and Y is the correlation a reader would see in sales and drowning figures. It has no arrowhead, because nothing flows from one to the other: ban ice cream and, on this diagram, the drownings stay the same.

  3. To see the link vanish, compare only days of the same temperature. Within a band of similar days, the diagram predicts that the correlation between X and Y falls toward zero.

The variables

  • Z, the confounder: hot weather, a cause of both the other variables.
  • X: ice cream sales. The arrow from Z reads “More people buy ice cream”.
  • Y: drownings. The arrow from Z reads “More people go swimming”, the route by which hot weather raises drownings.
  • X and Y: joined by a dotted line labeled “Correlated but neither causes the other”.

Ways to use it in teaching

  • Bring in a correlation from this week’s news. Small groups each propose a different confounder, draw it in this layout and say what data would rule their candidate in or out.

  • In a research design session, ask how an experiment would settle the question. Nobody can randomize the weather, so what could be randomized instead, and what would that study still miss?

  • Follow it with the Simpson’s paradox example, where a confounder, stone size, does more than create a correlation: it reverses one.

For how studies name and control their variables, see our guide to research variables.

This diagram appears in the article Independent and Dependent Variables: Definitions, Examples and Other Types (PDF, 16 pages, CC BY 4.0), citable by its DOI.

Sources

  • Çetinkaya-Rundel, M., & Hardin, J. (2024). Introduction to modern statistics (2nd ed.). OpenIntro. https://openintro-ims.netlify.app/
  • Confounding. (n.d.). In Wikipedia. Retrieved October 18, 2026, from https://en.wikipedia.org/wiki/Confounding
  • Correlation does not imply causation. (n.d.). In Wikipedia. Retrieved October 18, 2026, from https://en.wikipedia.org/wiki/Correlation_does_not_imply_causation
  • Spurious relationship. (n.d.). In Wikipedia. Retrieved October 18, 2026, from https://en.wikipedia.org/wiki/Spurious_relationship

Inference and evidence

Related diagrams

All open educational resources

Need something else?

Tell us which diagram, template or worked examples would help your teaching, and we’ll do our best to add it to the collection.