Correlation measures the strength and direction of the linear relationship between two variables.
The formula for the correlation coefficient (Pearson’s r) is:
\[r = \frac{\sum (x_i – \bar{x})(y_i – \bar{y})}{\sqrt{\sum (x_i – \bar{x})^2 \sum (y_i – \bar{y})^2}}\]
Where:
- \((x_i)\) and \((y_i)\) are the individual sample points.
- \((\bar{x})\) and \((\bar{y})\) are the means of the (x) and (y) samples, respectively.
GO ONE LEVEL DEEPER
How to interpret correlation in practice
Pearson’s r summarizes the direction and strength of a linear relationship. The sign describes direction; the absolute value describes strength.
Negative
As one variable rises, the other tends to fall.
No linear signal
There may still be a curved or segmented relationship.
Positive
Both variables tend to move in the same direction.
Keep in mind
- Inspect a scatter plot before trusting one number.
- Check whether a few outliers are driving the result.
- Correlation alone does not establish causation.