Pearson Correlation Coefficient (r)

Pearson’s r measures how strongly two variables follow a linear relationship. Here, the axes stay fixed, and noise adds jitter to both x and y symmetrically. This demo was made with Claude Code.

Current correlation
r = 0.000
n=200 cov(x,y)=0.000 σx=0.000 σy=0.000
1.00
0.25
200
Generator (fixed axes): we sample a latent t in [-1, 1], then x = t + noise·zx and y = slope·t + noise·zy, where zx, zy are standard normal. So the same noise level “blurs” both axes.
r = cov(x, y) / (σx · σy)

cov(x, y) = (1/(n-1)) · Σ (xi - x̄)(yi - ȳ)
σx        = sqrt( (1/(n-1)) · Σ (xi - x̄)² )
σy        = sqrt( (1/(n-1)) · Σ (yi - ȳ)² )

Interpretation: |r| → 1 means tight linear alignment; |r| → 0 means little linear association.

Scatter plot
Fixed domain: x ∈ [-3, 3], y ∈ [-3, 3]. Zero lines and best-fit line shown.