Beautiful Math
Path

Probability & information · Lesson 5

Correlation, sampling, and calibration

Covariance and correlation measure linear co-movement. Sampling adds uncertainty about estimates. Calibration asks whether a stated probability matches long-run frequency.

Core ~23 minDeep study ~67 minCan uncorrelated variables still depend on each other?What does a reliability diagram show?

Before this: Random variables and distributions, Expectation and loss

How this idea was born

Expectation summarizes a single random variable. Life immediately asks about pairs: when XX runs high, does YY tend to follow? A second human need arrives with every dataset: your estimate is from a sample, not the oracle distribution. A third need is uniquely modern in ML dashboards: when a model says "80%80\%," does the world agree?
Francis Galton (1822-1911) helped push regression and correlation into quantitative scientific practice; MacTutor sketches the career. Karl Pearson later standardized the product-moment correlation coefficient widely used today; MacTutor's Pearson biography covers that biometric program. Steal Galton's measuring instinct carefully, and keep the moral warning loud: association is not automatic causation. (Galton's broader historical legacy is complicated; this chapter borrows the measurement ethic, not a sanitized hero poster.)
For a modern rereader, covariance/correlation, sampling uncertainty, and calibration are three instruments on one workbench.

First principles

predicted probability
Calibration asks: when you say 90%, do about 9 in 10 happen? Reliability is claimed probability versus observed frequency.
For random variables X,YX,Y with finite means and variances,
Cov(X,Y)=E[(XμX)(YμY)],\mathrm{Cov}(X,Y)=\mathbb{E}[(X-\mu_X)(Y-\mu_Y)], Corr(X,Y)=Cov(X,Y)σXσY[1,1]\mathrm{Corr}(X,Y)=\frac{\mathrm{Cov}(X,Y)}{\sigma_X\sigma_Y}\in[-1,1]
(when σXσY>0\sigma_X\sigma_Y>0). Correlation scales covariance to a unitless linear-association score. ±1\pm 1 signals perfect linear relationship almost surely; 00 means uncorrelated, not necessarily independent.
Sampling uncertainty: an estimate ρ^\hat\rho or Xˉ\bar X from nn draws wobbles. Larger nn typically tightens the wobble (under standard assumptions), but dependence, bias, and heavy tails can spoil naive confidence. Always ask what was sampled and how.
Calibration of probabilities: among cases where a model predicts probability near pp, the observed frequency should be near pp if the model is calibrated. Reliability diagrams bucket predictions and compare forecast average to outcome rate. Sharpness (confident predictions) without calibration is stylish false precision.

Worked intuition

Covariance is an expected product of centered deviations: same-direction wanderings push it positive; opposite wanderings push it negative. Correlation divides out scales so meters and millimeters can talk.
Sampling is the humility layer. A correlation of 0.40.4 on n=20n=20 noisy points is a rumor; on n=105n=10^5 carefully collected points it is a stronger claim (still not causation).
Calibration is keeping promises about frequencies. Weather forecasts taught this publicly; classifiers must relearn it whenever they optimize a proxy loss that does not enforce reliability.
Algebrica's variance-and-covariance page is the formal stop for the first instrument.

Common confusions

Uncorrelated implies independent. False in general. Independence implies uncorrelated (when moments exist); the converse needs extra structure ( jointly Gaussian is the famous friendly case).
Correlation implies causation. The slogan is famous because the mistake is common. Confounders and selection create dances without direct arrows.
Calibration equals accuracy. A model can be calibrated and still useless (always predict the base rate). A model can be accurate on hard labels yet miscalibrated on probabilities.
Bigger sample fixes bias. Sample size fights variance; bias from bad sampling frames needs design fixes.
ρ|\rho| near 1 always means "strong for my task." Linear association can be strong while the relationship you care about is nonlinear or conditional.
Test-set metrics without sampling talk. Every reported AUC/accuracy is an estimate. Especially fragile on small or shifting populations.

History & stories

Galton's program made co-relation a scientific habit; Pearson's product-moment coefficient standardized a workhorse formula; later statistics deepened sampling distributions and errors-in-variables. Calibration as a named ML concern rides on older meteorological and probabilistic forecasting ethics: stated probabilities should mean something in frequency.

Real world

Doctors reading risk scores need calibration, not only ranking. Marketers correlating ad spend with sales must hunt confounders (seasonality). Pollsters live and die by sampling frames.
A forecast office that says "70%70\% rain" on many days should see rain on about 70%70\% of those days. That is the public face of this chapter.

Open when you want the machine-learning connection. Skip freely.

Field notes, extra examples, and glossary live here when you want more than the core path.

Carry this forward

  • Pairs need covariance language; estimates need sample humility; probabilities need calibration.
  • Next: information and entropy score surprise and uncertainty.

Read more

Go deeper when curiosity hits - videos, essays, and primary trails.

Check your understanding

A short learning loop - try a few, learn from misses, mark complete when you have engaged. No timer, no scoreboard.

1.Correlation ρ is…
2.Uncorrelated means…
3.Calibration asks whether…
4.Sampling uncertainty…
5.Association vs causation…

Try at least 3 core prompts, or choose I'll return later.