Kalkmi Online calculators
en
English

Linear Regression Calculator

Fit a line to paired measurements, inspect residuals, compare mean and individual prediction intervals, and explore the influence of one point.

Fit a line to your paired measurements, then look at the residuals before trusting a prediction. All calculations stay in your browser.

Paired observations and prediction
One pair per line. Separate x and y with comma, tab or space. Use a decimal point, e.g. 1.25; no thousands grouping or header row. 2–2,000 pairs. Missing and nonnumeric values are rejected.
A location in your x units. Predictions beyond the observed range are extrapolations.
Pointwise, two-sided intervals. Choose before examining the results.

Least-squares line · all 5 points

ŷ = 2.2 + 0.6 × x

Centered form: ŷ − 4 = 0.6 × (x − 3)

Slope 0.6Correlation r 0.77459667R² 0.6Residual SD 0.89442719

R² alone does not establish a good model, and correlation does not establish cause. A curved pattern or widening spread in residuals can make these linear-model intervals inappropriate.

Line and observations

Axes show offsets from x̄ = 3 and ȳ = 4.

Coral: observations. Teal: fitted line. Inspect a point to see its actual values and residual.

Residuals against x

Residual = observed y − fitted y. Above zero: the line under-predicts. Patterns matter more than a high R².
Teal band: confidence interval for the mean responseSand band: prediction interval for one new observation

Prediction at x = 3

Fitted value 4

95% confidence interval · mean response

2.72702148 to 5.27297852Uncertainty in the average y at this x.

95% prediction interval · one new observation

0.88185217 to 7.11814783Also includes individual scatter, so it is wider.

Intervals assume a linear relationship, independent errors, constant error variance and normally distributed errors. They are pointwise intervals, not a simultaneous confidence band or a guaranteed future range.

Calculation and fitted values

Explore a pattern

Synthetic examples. Each resets the data, prediction and confidence level.

How to interpret the line, residuals and intervals

One predictor, one response

Ordinary least squares minimizes the sum of squared vertical residuals. With an intercept, b = Sxy / Sxx and a = ȳ − bx̄. The centered form ŷ − ȳ = b(x − x̄) avoids subtracting large nearly equal numbers.

Residual standard deviation is s = √(SSE / (n − 2)). At a chosen x₀, h = 1/n + (x₀ − x̄)² / Sxx. The confidence interval for the mean is ŷ ± t × s√h. A prediction interval for a new observation is ŷ ± t × s√(1 + h), using n − 2 degrees of freedom.

Two points define a line but cannot estimate the residual scatter. When the residual variance is exactly zero, the fitted line is shown but intervals are withheld: a perfect fit in observed data does not establish certain future outcomes. Constant y makes r and R² undefined; constant x does not identify a unique slope.

Temporary exclusion is a sensitivity check, not permission to discard inconvenient data. This tool does not fit multiple predictors, weighted models, nonlinear curves or causal effects. Use standard deviation to describe a single sample, or the confidence interval calculator to estimate one mean or binomial proportion.

Method references: NIST least squares, residual validation, mean-response uncertainty and individual prediction uncertainty.

Was this calculation useful?
It takes one second and helps others choose a useful calculator.

Help improve Kalkmi Report an issue or request a useful calculator.
Suggest a calculator
Text copied
Removal error
Restore error
Calculator published
Calculator unpublished
Feedback sent
Done
Error
Author received:++
Calculator removed
Install as an app

Open the browser menu and choose “Add to Home Screen” or “Install app”.