AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Covariance & Correlation Map

Move paired values; separate direction, strength and units.

Your dataset

Drag a dot to change its value

Each numbered dot is one quantitative (X, Y) pair. Dashed lines cross at the current means. Drag a dot or select its number below and use the coordinate controls. Labels have leader lines; the dots encode the actual values.

Point 5: X = 8.0000, Y = 8.0000. Covariance = 6.5000; Pearson r = 1.0000.

02468100246810YX · current units12345

Mean X = 5.0000; mean Y = 5.0000. Five paired observations; sample denominator n − 1 = 4.

Selected Point 5, in current X units. Grid step 0.5; bound 10. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Selected Point 5. Moving a pair recomputes both means and all departure products. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Positive factor applied to every X number, its mean, SD and covariance. Y values stay fixed. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Positive unit changes rescale X numbers and the X axis ticks together. The point pattern stays in place because the axis uses the new units too. Point edits change the underlying pairs. Coincident points remain separately selectable by number; when dragging coincident dots, the selected point takes priority.

Paired departures from the means

Point 5: (8.0000 − 5.0000) × (8.0000 − 5.0000) = 3.0000 × 3.0000 = 9.0000.

Same-sign departures give positive products; opposite signs give negative products; a zero departure gives zero. Every center and product is recomputed after a pair changes.

Sum of products = 26.0000. Sample covariance = 26.0000 / 4 = 6.5000. Sample SD X = 2.5495; sample SD Y = 2.5495.

Sample covariance

Signed co-variation, in X units × Y units.

6.5000

Σ[(X − mean X)(Y − mean Y)] / (n − 1)

Pearson r

Unitless direction and linear alignment.

1.0000

6.5000 / 6.5000

Spread product

Both sample spreads normalize covariance.

6.5000

sX × sY = 2.5495 × 2.5495

r describes linear association, not slope, probability or causation. Zero correlation need not mean independence or no nonlinear relationship. If either variable has zero spread, r is undefined. These five toy pairs are descriptive data; no population estimate, test or causal conclusion is supplied.

Paired values and departure products
Five current pairs; all departures use the current means. Sample covariance divides the sum by 4.
PointXYX departureY departureProduct
12.00002.0000-3.0000-3.00009.0000
23.00003.0000-2.0000-2.00004.0000
35.00005.00000.00000.00000.0000
47.00007.00002.00002.00004.0000
58.00008.00003.00003.00009.0000
Sum of paired products26.0000
Conventions and sources

Sample covariance and both sample variances use n − 1 = 4; sample SD is the square root of sample variance. Dividing all three by n instead gives different covariance and SDs but the same Pearson r when spread is nonzero. Pearson r equals covariance divided by the product of the consistently defined SDs. Positive scale factors cancel. Negating just one variable would reverse the sign.

The finite editable grid contains five pairs with base values 0 to 10 in half-unit steps. X unit multiplier is a positive integer 1 to 5; X editors use displayed units and a correspondingly scaled grid. Statistical calculations precede display rounding. Dots remain correctly mapped when axis labels change; displaced number labels identify dots through leader lines. Strong nonlinear patterns, outlier diagnostics, inference and confounding have separate lessons.

NIST · Pearson correlation formula
NIST · Sample covariance convention
Berkeley · Unit transformations and correlation