Linear Regression and Correlation

Scatterplot, correlation r, r², the least-squares line, and predictions.

Inputs

Paste or type numbers separated by commas, spaces, or new lines. A column copied from Excel or Google Sheets works too.

Same order as the x values.

Results update as you type.

Results

ŷ = 51.4783 + 3.4674x  ·  r = 0.9967

There is a strong positive linear relationship between hours studied and exam score. Each 1-unit increase in hours studied goes with a predicted change of 3.4674 in exam score, and 99.3% of the variation in exam score is explained by the line. At x = 7, the predicted exam score is 75.75.

Scatterplot of Exam score versus Hours studied with 8 points and the least-squares line ŷ = 51.4783 + 3.4674x. The points show a strong positive linear pattern (r = 0.9967).6070809024681012Hours studiedExam score

Results

Slope b3.4674
y-intercept a51.4783
Correlation r0.9967
r²0.9934
Standard error of estimate se1.1107
n8
Test of ρ = 0: t, p-value29.9428, 9.2033 × 10⁻⁸
Significant at α = 0.05?Yes
ŷ at x = 775.75

On the TI-84

x in L1, y in L2. Turn on r and r² once: MODE → STAT DIAGNOSTICS: ON (or 2nd 0 (CATALOG) → DiagnosticOn). Then STAT → CALC → 8:LinReg(a+bx).

LinReg(a+bx) L1, L2, Y1

Test of the correlation: STAT → TESTS → F:LinRegTTest.

LinRegTTest L1, L2, 0, ≠

Show steps
  1. Means. x̄ = 7, ȳ = 75.75.
  2. Sums of squares. Sxx = Σ(x − x̄)² = 92, Syy = Σ(y − ȳ)² = 1113.5, Sxy = Σ(x − x̄)(y − ȳ) = 319.
  3. Slope. b = Sxy ÷ Sxx = 319 ÷ 92 = 3.4674
  4. Intercept. a = ȳ − b·x̄ = 75.75 − (3.4674)(7) = 51.4783
  5. Correlation. r = Sxy ÷ √(Sxx Syy) = 0.9967, so r² = 0.9934.
  6. Prediction. ŷ = 51.4783 + 3.4674(7) = 75.75

About this calculator

What the numbers mean

Cautions

Always look at the scatterplot first. A curved pattern or an outlier can make r misleading. Don't predict far outside the range of your x values (extrapolation). And correlation is not causation: two variables can move together because of a third variable.