Formulas
| Quantity | Formula |
|---|---|
| Correlation | r = Sxy ÷ √(Sxx · Syy) |
| Slope | b = Sxy ÷ Sxx |
| Intercept | a = ȳ − b·x̄ |
| Line of best fit | ŷ = a + b·x |
| Significance test | t = r·√(n − 2) ÷ √(1 − r²), df = n − 2 |
Sxx = Σ(x − x̄)², Syy = Σ(y − ȳ)² and Sxy = Σ(x − x̄)(y − ȳ).
How to interpret r
| |r| | Strength (rule of thumb) |
|---|---|
| 0.9 – 1.0 | Very strong |
| 0.7 – 0.9 | Strong |
| 0.5 – 0.7 | Moderate |
| 0.3 – 0.5 | Weak |
| 0 – 0.3 | Very weak or none |
These cut-offs vary between fields. Always look at the scatter plot too: one outlier can create or hide a correlation.
Before you trust the result
- Check the scatter plot is roughly straight. A curved relationship can have r near 0 even though x and y are closely linked.
- Look for outliers that pull the line toward them.
- Don’t extrapolate far beyond the range of your x values.
To summarize each variable on its own, use the descriptive statistics calculator.
What different correlations look like
Worked example: study hours and exam scores
For the default data (10 students), r = 0.992 and R² = 0.985: hours studied explain about 98% of the variation in scores. The line of best fit is ŷ = 48.47 + 4.98x, so each extra hour of study goes with about 5 more points, and a student who studies 5.5 hours is predicted to score about 75.9.
Now add one unusual student who studied 20 hours but scored 40. The correlation drops to −0.25. A single outlier can wipe out, or even reverse, a strong relationship. That’s why you should always look at the scatter plot.
Common mistakes to avoid
- Assuming causation. A strong r shows the variables move together, not that one causes the other.
- Ignoring curved relationships. r only measures straight-line association. A perfect U-shape can have r near 0.
- Extrapolating. Predictions far outside the observed x range are unreliable.
- Confusing r with the slope. A steep line can have a weak r, and a shallow line a strong r.
Do it in other software
| Software | How |
|---|---|
| Excel / Google Sheets | =CORREL(xs, ys), =RSQ(ys, xs), =SLOPE(ys, xs), =INTERCEPT(ys, xs); LINEST for the full regression. |
| TI-84 | Turn on DiagnosticOn (CATALOG), then STAT › CALC › LinReg(ax+b) L1, L2 to see r and r². |
| Python | scipy.stats.pearsonr(x, y) for r and p; numpy.polyfit(x, y, 1) for the line; scipy.stats.spearmanr for Spearman’s rho. |
Related tools: Descriptive Statistics Calculator, Standard Deviation Calculator, Z-Score Calculator, Histogram Maker and Mean, Median & Mode Calculator.