Every point is one location. X is a claimed physiological effect (e.g. a self-reported symptom score) and Y is the alleged UFO sighting rate there. Neither causes the other — but both are driven upward by the same lurking variable Z, local pollution: particulates cause real physiological symptoms, and the same haze scatters light into optical anomalies that get reported as sightings. Because X and Y share a common cause, they move together even with zero direct link, producing a strong raw correlation and the tempting — and wrong — dashed trend line.
Controlling for Z with the partial-correlation formula removes the shared drift and should leave the direct X–Y link near zero:
r(X,Y) = raw Pearson correlation
r(X,Y|Z) = [ r(X,Y) − r(X,Z)·r(Y,Z) ] / √[(1 − r(X,Z)²)(1 − r(Y,Z)²)]
- Confound strength — how hard pollution pulls on both X and Y. At 0 there is no confound: raw and partial correlation should already agree (both near zero).
- Sample size — more points make the raw-vs-partial gap and the regression fit more stable and less noisy.
- Noise level — random scatter added on top of each variable's dependence on Z; higher noise weakens every correlation, confounded or not.
- Show confound — toggles colour-coding each point by its pollution level Z (blue = low, red = high). With it on you can see the real driver; with it off you only see what a naive analyst sees — the raw scatter and its misleading trend.
Real-world relevance: this is the textbook failure mode behind many "mystery correlation" claims — two measured quantities track each other tightly not because one causes the other, but because an unmeasured third variable drives both. Partial correlation (or, more generally, regression adjustment) is the standard first check before inferring causation from an association.