Skip to content
Zesona
Linear Regression CalculatorLocal

Linear Regression Calculator

Fit a least-squares line with an exact slope and intercept, with the residuals and the assumptions the fit rests on.

  • Free
  • No sign-up
  • Runs in your browser

Input

Runs in your browser

13 characters

At least three values.

13 characters

The same number of values as x, in matching order.

How many digits to show when the answer is irrational. An exact answer ignores this.

Ready

Everything happens on this device. No upload, no account, no network request.

How to use this tool

  1. 1

    Paste matching lists of x and y values.

  2. 2

    The slope and intercept are exact. Check the residual table before trusting the fit.

Questions about Linear Regression Calculator

Why is the slope exact?

Because it is a ratio of exact sums of the data, with no square root anywhere - so this is the true least-squares line, not a close approximation of it. NumPy’s polyfit gives an intercept of 2.199999999999999 for a case where the exact value is 11/5.

What should I look for in the residuals?

A pattern. Residuals should look like noise with no structure; if they curve, or fan out as x grows, a straight line is the wrong model whatever r squared says. Least squares assumes the errors are independent, have constant variance and are roughly normal, and the residuals are where you check all three.

Can I predict outside the range of my data?

Not safely. The fit says nothing about behaviour outside the x values it saw, and extrapolation is where regression most often misleads. A line fitted to childhood heights predicts a twenty-foot adult.

Why divide by n - 2 for the standard error?

Because two parameters - the slope and the intercept - were estimated from the data, so two degrees of freedom are used up. Dividing by n - 1, as for a plain variance, would understate the uncertainty.

Is my data sent anywhere?

No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.

Other tools you might reach for next.