Pearson Correlation
Measuring Linear Relationship
Pearson's r measures the strength and direction of a LINEAR relationship between two continuous variables. It ranges from -1 (perfect negative) to +1 (perfect positive), with 0 meaning no linear relationship.
How r is Calculated
Sum of cross-products of deviations
Product of standard deviations
The formula standardizes the covariance between X and Y. When X is above its mean and Y is above its mean (or both below), the product is positive, contributing to positive r.
Understanding r Values
| |r| = 0.0 - 0.1 | Negligible |
| |r| = 0.1 - 0.3 | Weak |
| |r| = 0.3 - 0.5 | Moderate |
| |r| = 0.5 - 0.7 | Strong |
| |r| = 0.7 - 1.0 | Very Strong |
The magnitude |r| indicates strength regardless of direction. These benchmarks are guidelines—context matters. In some fields, r = 0.3 is considered strong.
Coefficient of Determination
r² (r-squared) is the proportion of variance in Y explained by X. If r = 0.7, then r² = 0.49, meaning X accounts for 49% of Y's variability. This is often more meaningful than r itself.
Direction & Strength
Positive Correlation
Positive correlation: both variables move in the same direction. When one goes up, the other tends to go up too. Higher X values are associated with higher Y values.
Negative Correlation
Negative correlation: variables move in opposite directions. When one goes up, the other tends to go down. Higher X values are associated with lower Y values.
No Correlation
r ≈ 0 means no LINEAR relationship. The scatter has no upward or downward trend. But beware: there could still be a strong NON-LINEAR relationship that r won't detect.
Comparing Strengths
Perfect
Strong
Moderate
Strength shows how tightly points cluster around the trend line. Perfect correlation (r = ±1) has all points exactly on a line. Weaker correlations have more scatter.
Spearman Correlation
Rank-Based Correlation
| X: 2, 5, 8, 15, 50 |
| Y: 10, 20, 25, 40, 100 |
| X: 1, 2, 3, 4, 5 |
| Y: 1, 2, 3, 4, 5 |
Spearman's ρ (rho) converts values to ranks, then calculates Pearson r on those ranks. It measures monotonic relationships (consistently increasing or decreasing), not just linear ones.
Spearman vs Pearson
• Relationship is linear
• No extreme outliers
• Data approximately normal
• Non-linear monotonic relationship
• Outliers present
• Non-normal distributions
Spearman is more robust than Pearson. It works with ordinal data, handles outliers better, and captures monotonic non-linear relationships. Use it when Pearson's assumptions are violated.
Capturing Monotonic Relationships
This relationship is curved (non-linear) but monotonic (always increasing). Pearson underestimates it because it's not a straight line. Spearman captures it perfectly because ranks preserve order.
Correlation Pitfalls
Correlation ≠ Causation
Does ice cream cause drowning? NO!
Correlation shows association, NOT causation. Two variables can correlate because: (1) X causes Y, (2) Y causes X, (3) a third variable causes both, or (4) pure coincidence. Never assume causation from correlation alone.
Outlier Sensitivity
One outlier can dramatically change r. Always visualize your data with a scatter plot before trusting a correlation coefficient. A single extreme point can create or destroy a correlation.
Range Restriction
If your sample has a restricted range on X or Y, correlation will be underestimated. Studying only top students? You'll find weaker SAT-GPA correlation than in the full population.
Non-Linear Relationships
Pearson r = 0 for this U-shaped pattern, yet there's clearly a strong relationship. Correlation only measures LINEAR association. Always visualize data—non-linear patterns can have r ≈ 0.
Interactive Correlation Explorer
Click on the canvas to add points and watch the correlation coefficient (r) update in real time. Try the preset buttons to see how different patterns produce different correlations. Notice that the non-linear pattern has r ≈ 0 even though there's a clear relationship!
Real-World Examples
Apply your knowledge to practical scenarios
The Ice Cream and Drowning Paradox
A news report claims: 'Ice cream sales strongly correlate with drowning deaths (r = 0.85). Should we ban ice cream to save lives?'
Key Insights
- Correlation can be perfect (r = 1.0) yet completely spurious
- Always ask: 'What third variable could cause both?'
- Establishing causation requires experimental design or careful controls
Marketing Spend vs Sales Analysis
A marketing team calculates that advertising spend and monthly sales have r = 0.72 (r² = 0.52). The CEO asks: 'So if we double our ad spend, sales will increase by 72%?'
Sample Data
{
"r": 0.72,
"r_squared": 0.52,
"n": 36
}
Key Insights
- r is not a percentage and doesn't indicate magnitude of effect
- r² (coefficient of determination) is often more interpretable
- Business decisions need regression coefficients, not just correlation
The Suspicious Correlation
A researcher reports r = 0.89 between study hours and exam scores in a class of 25 students. But when you plot the data, you notice something concerning.
Key Insights
- One outlier can inflate correlation from 0 to 0.9
- ALWAYS plot your data before calculating correlations
- Anscombe's Quartet: identical r doesn't mean identical relationships
Correlation Quiz
Test your understanding • Passing score: 70%