Linear regression
Linear regression calculator
Paste x and y values. Get the line of best fit, slope, intercept, r and R², with the working and a scatter plot.
- ŷ = 5 × 6.5 + 50 = 82.5
| Prediction at x = 6.5 | 82.5 |
|---|---|
| Slope, 95% CI | 2.55 to 7.45 |
| Slope, t(6) = 5 | p = 0.0025 |
| Residual standard error | 6.4807 |
The example
Eight students study for 1 to 8 hours and score 61, 51, 65, 73, 81, 71, 85 and 93. The line of best fit is ŷ = 5x + 50: each extra hour goes with 5 more points, and 6.5 hours predicts a score of 82.5. R² is 0.806, so the line accounts for 81% of the variation in the scores.
FAQ
- How do you calculate the line of best fit?
- Least squares picks the line with the smallest sum of squared residuals. Its slope is Σ(x − x̄)(y − ȳ) / Σ(x − x̄)², and its intercept is ȳ − slope × x̄.
- What is the difference between r and R²?
- r is the correlation, from −1 to 1, with the sign of the slope. R² is the share of the variation in y that the line accounts for, from 0 to 1. With one x, R² is r squared.
- Is this the same as LinReg on a TI-84 or SLOPE in Excel?
- Yes. LinReg(ax+b) on a TI-84 returns the same slope a, intercept b, r and r², and Excel's SLOPE, INTERCEPT and RSQ give the same numbers.
Flashcards
More calculators
About · Quizzes · Tools · History of AI · To suggest new questions or report an error send me a dm.