02 · Learning path
Correlation
Normalized covariance: a number between -1 and 1 that measures the strength of a linear relationship.
Pearson correlation is probably the most widely used measure of the relationship between two variables. Unlike covariance, it is normalized and always lies between -1 and 1.
Definition
The correlation
where
Interpretation
- 1: perfect positive linear relationship.
- 0: no linear relationship.
- -1: perfect negative linear relationship.
Play with a sample
Change the target correlation and the sample size. You will see that the observed coefficient fluctuates because of sampling noise, even though the underlying relationship is always the same.
Correlation lab
Pearson in real time
Settings
With small n, r fluctuates a lot around ρ.
Reading
Positive relationship
r = 0.683; r² = 0.467, i.e. the line explains 46.7% of the variance of Y.
Observed r
0.683
95% CI (Fisher)
[0.46, 0.83]
Slope
0.773
- r ≥ 0
- r < 0
- Least-squares line
What to look for
- Push ρ to ±0.95 and the cloud tightens around the line.
- Lower n: the CI widens and r drifts away from ρ.
- r only measures linear association; it does not imply causation.
Why it is better than covariance
Because it lives in a fixed range, it lets you compare the relationship between “height and weight” with that between “temperature and electricity consumption” without worrying about units.