Statistics and research
Linear regression calculator
Least-squares line with standard errors, t-tests, R², ANOVA table, residuals and leverage, plus confidence and prediction intervals at any x.
Runs in your browser. What you enter stays on this page and is not uploaded.
Results
- Equation
- ŷ = -0.26232307 + 1.0021168 x
- R²
- 0.99999375
- Adjusted R²
- 0.99999356
- Correlation r
- 0.99999687
- Residual standard error
- 0.884796396144 on 34 df
- F statistic
- 5436385.5 on 1 and 34 df, p 4.654e-90
- Predicted ŷ at x = 500
- 500.79609
- 95% confidence interval for the mean response
- 500.4882 to 501.10398
- 95% prediction interval for a new observation
- 498.97179 to 502.62038
| Term | Estimate | Std. error | t | p-value | 95% CI lower | 95% CI upper |
|---|---|---|---|---|---|---|
| Intercept | -0.262323073774 | 0.232818234301 | -1.12673 | 0.2677 | -0.73546665 | 0.2108205 |
| Slope | 1.00211681802 | 0.0004297968482 | 2331.61 | 4.654e-90 | 1.0012434 | 1.0029903 |
| Source | df | Sum of squares | Mean square | F | p-value |
|---|---|---|---|---|---|
| Regression | 1 | 4255954.13232 | 4255954.13232 | 5436385.5 | 4.654e-90 |
| Residual | 34 | 26.6173985294 | 0.78286466263 | ||
| Total | 35 | 4255980.74972 |
| # | x | y | Fitted ŷ | Residual | Leverage h | Studentized residual |
|---|---|---|---|---|---|---|
| 1 | 0.2 | 0.1 | -0.06189971 | 0.1619 | 0.0692 | 0.1897 |
| 2 | 337.4 | 338.8 | 337.85189 | 0.948109 | 0.02936 | 1.088 |
| 3 | 118.2 | 118.1 | 118.18788 | -0.0878848 | 0.04915 | -0.1019 |
| 4 | 884.6 | 888 | 886.21021 | 1.78979 | 0.07889 | 2.108 |
| 5 | 10.1 | 9.2 | 9.8590568 | -0.659057 | 0.06726 | -0.7713 |
| 6 | 226.5 | 228.1 | 226.71714 | 1.38286 | 0.03654 | 1.592 |
| 7 | 666.3 | 668.5 | 667.44811 | 1.05189 | 0.04219 | 1.215 |
| 8 | 996.3 | 998.5 | 998.14666 | 0.353337 | 0.1064 | 0.4224 |
| 9 | 448.6 | 449.1 | 449.28728 | -0.187281 | 0.02798 | -0.2147 |
| 10 | 777 | 778.9 | 778.38244 | 0.517555 | 0.05799 | 0.6027 |
| 11 | 558.2 | 559.2 | 559.11928 | 0.0807153 | 0.03234 | 0.09274 |
| 12 | 0.4 | 0.3 | 0.13852365 | 0.161476 | 0.06916 | 0.1892 |
| 13 | 0.6 | 0.1 | 0.33894702 | -0.238947 | 0.06912 | -0.2799 |
| 14 | 775.5 | 778.1 | 776.87927 | 1.22073 | 0.05774 | 1.421 |
| 15 | 666.9 | 668.8 | 668.04938 | 0.750617 | 0.04226 | 0.8669 |
| 16 | 338 | 339.3 | 338.45316 | 0.846839 | 0.02933 | 0.9715 |
| 17 | 447.5 | 448.9 | 448.18495 | 0.715047 | 0.02797 | 0.8197 |
| 18 | 11.6 | 10.8 | 11.362232 | -0.562232 | 0.06698 | -0.6578 |
| 19 | 556 | 557.7 | 556.91463 | 0.785372 | 0.0322 | 0.9023 |
| 20 | 228.1 | 228.3 | 228.32052 | -0.0205231 | 0.03639 | -0.02363 |
| 21 | 995.8 | 998 | 997.6456 | 0.354396 | 0.1062 | 0.4237 |
| 22 | 887.6 | 888.8 | 889.21656 | -0.416565 | 0.07955 | -0.4907 |
| 23 | 120.2 | 119.6 | 120.19212 | -0.592118 | 0.04887 | -0.6862 |
| 24 | 0.3 | 0.3 | 0.038311972 | 0.261688 | 0.06918 | 0.3066 |
| 25 | 0.3 | 0.6 | 0.038311972 | 0.561688 | 0.06918 | 0.658 |
| 26 | 556.8 | 557.6 | 557.71632 | -0.116321 | 0.03225 | -0.1336 |
| 27 | 339.1 | 339.3 | 339.55549 | -0.25549 | 0.02929 | -0.2931 |
| 28 | 887.2 | 888 | 888.81572 | -0.815718 | 0.07946 | -0.9609 |
| 29 | 999 | 998.5 | 1000.8524 | -2.35238 | 0.1071 | -2.814 |
| 30 | 779 | 778.9 | 780.38668 | -1.48668 | 0.05833 | -1.732 |
| 31 | 11.1 | 10.2 | 10.861174 | -0.661174 | 0.06707 | -0.7737 |
| 32 | 118.3 | 117.6 | 118.2881 | -0.688096 | 0.04914 | -0.7975 |
| 33 | 229.2 | 228.9 | 229.42285 | -0.522852 | 0.03629 | -0.602 |
| 34 | 669.1 | 668.4 | 670.25404 | -1.85404 | 0.04252 | -2.141 |
| 35 | 448.9 | 449.2 | 449.58792 | -0.387917 | 0.02799 | -0.4447 |
| 36 | 0.5 | 0.2 | 0.23873534 | -0.0387353 | 0.06914 | -0.04538 |
Studentized residuals (internally) beyond about ±2 deserve a look; leverage above 4/n marks influential x values.
Method and limits
How to use it
Paste the predictor values (X) and the response values (Y) in the same order. Optionally enter an x at which to predict: you get the fitted value, a confidence interval for the mean response and a prediction interval for a single new observation.
Formulas
- Slope b₁ = Sxy / Sxx, intercept b₀ = ȳ − b₁x̄, with Sxx = Σ(x − x̄)², Sxy = Σ(x − x̄)(y − ȳ).
- Residual SE s = √(SSE / (n − 2)); SE(b₁) = s / √Sxx; SE(b₀) = s √(1/n + x̄²/Sxx); t = estimate / SE with n − 2 df.
- R² = 1 − SSE / SST; adjusted R² = 1 − (1 − R²)(n − 1)/(n − 2); F = MSR / MSE on 1 and n − 2 df.
- At x₀: mean response ŷ ± t s √(1/n + (x₀ − x̄)²/Sxx); prediction ŷ ± t s √(1 + 1/n + (x₀ − x̄)²/Sxx).
- Leverage hi = 1/n + (xi − x̄)²/Sxx; studentized residual ei / (s √(1 − hi)).
Assumptions and limits
- A straight-line relation, independent errors with constant variance; normal errors for the tests and intervals. Check the residual table for curvature, outliers (|studentized| > 2) and high leverage (> 4/n).
- Predictions outside the observed range of X are extrapolation and are flagged.
- One predictor only. Up to 100,000 pairs; the residual table shows the first 1,000.
Worked example
The default data are NIST’s Norris ozone-monitor calibration set (36 pairs). The fit is ŷ = −0.262323073774 + 1.00211681802 x, R² = 0.999993745884, residual SE 0.884796 on 34 df — the NIST certified values to at least 10 significant digits. At x = 500 the prediction interval is 498.97 to 502.62.
References
Related tools
- Correlation coefficient calculatorPearson’s r and Spearman’s rank correlation ρ for paired data, with p-values, r² and a confidence interval for r.
- Cronbach’s alpha calculatorInternal-consistency reliability of a scale: Cronbach’s α with Feldt’s confidence interval, standardized α and α-if-item-deleted for each item.
- Standard deviation calculatorPaste data to get the standard deviation (sample and population), variance, mean, median, mode, quartiles with the method stated, IQR, outliers, skewness and kurtosis.
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.
- P-value calculatorFind the p-value and critical values for a z, t, chi-square or F test statistic, one- or two-tailed, accurate far into the tails.