InputTestHub

Linear Regression Calculator

Fits a least-squares line to paired data and gives the slope, intercept, r squared, standard error and prediction intervals at any value of x.

Calculators Nothing uploaded No sign-up Free, unlimited
Calculators tool
Enter your figures and press Calculate.
In short Least-squares regression fits the straight line that minimises the sum of the squared VERTICAL distances from the points to the line. For the eight pairs loaded above it gives y = 0.9167x + 1.5, with r² = 0.9318. The slope is the practical result: every one-unit rise in x goes with a change of 0.9167 in y. The page also reports the standard error of the slope, its confidence interval, and the significance test — which is the same t-test the correlation page reports for r, because a zero slope and a zero correlation are the same hypothesis. Three things are easy to get wrong. Regressing y on x and x on y give DIFFERENT lines, not the same line rearranged, because only vertical distances are minimised; the two slopes multiply to r². The intercept is the fitted value at x = 0, and if zero is outside the range of your data it is an extrapolation the data does not evidence, however precise it looks. And there are two prediction intervals, not one: the interval for the MEAN y at a given x is much narrower than the interval for a SINGLE new observation there, and the second is almost always the one people actually want. Finally, a high r² means the line fits, not that the model is right. Plot the residuals — a clear pattern in them is the data telling you a straight line was the wrong shape.

How to use the Linear Regression Calculator

  1. Enter your figures in the input fields.
  2. The result updates as you type, together with the full working.
  3. Check the breakdown table to see exactly how the number was reached.

About the Linear Regression Calculator

The least-squares line through paired data, with its slope, fit, significance and prediction intervals.

What people use it for

  • Finding the line of best fit through measurements.
  • Quantifying how much y changes per unit of x.
  • Predicting a value with an honest interval around it.

Details

The line always passes throughthe point (x̄, ȳ)
What is minimisedsquared VERTICAL distances, not perpendicular ones
Regressing x on y insteadgives a different line — the slopes multiply to r²
r² isexplained variation ÷ total variation
Interval for a single new pointalways wider than for the mean response

The maths behind it

This tool uses slope = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², and the line always passes through (x̄, ȳ). Every intermediate value is shown on screen, so the result can be checked by hand.

The sums of squares are printed and they split exactly — total equals explained plus residual — which is what least squares actually minimises, shown rather than asserted.

Where this tool stops

This fits a straight line to two variables and assumes the scatter is roughly constant across the range and the observations independent. It does not handle curvature, several predictors, or time-ordered data where consecutive points are related.

Frequently asked questions

Why are there two prediction intervals?
One is for the average y of everything at that x, the other for a single new observation. The second must be wider because it carries the scatter of individual points on top of the uncertainty in the line, and it is usually the one that matters.
Can I predict outside the range of my data?
The arithmetic will happily give you a number, and the page warns you when you ask for one. The data provides no evidence about that region, and the straight-line assumption is exactly what is least likely to survive out there.
Is a high r² enough to trust the model?
No. r² measures how well a LINE fits, not whether a line was the right shape. Plot the residuals: a curve or a fan in them means the model is wrong regardless of r².
Why does regressing x on y give a different answer?
Because least squares minimises vertical distances only, so swapping the axes changes what is being minimised. The two slopes multiply to r², and they coincide only when the fit is perfect.
Is the Linear Regression Calculator free, or is there a paid tier?
It is free, with no account, no trial and no daily cap. Every calculators tool on inputtesthub.com works the same way: open the page and use it.
Is what I paste into the Linear Regression Calculator stored?
No. The Linear Regression Calculator runs entirely in your browser using JavaScript. Nothing is transmitted, logged or stored, which you can verify yourself in the Network tab of your browser's developer tools.
What is the equation behind the Linear Regression Calculator?
It uses slope = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², and the line always passes through (x̄, ȳ). The full working is printed under the result, so you can follow every step rather than trusting a black box.
What does a typical result look like?
Enter 8 pairs, x = 1..8 and the Linear Regression Calculator returns y = 0.9167x + 1.5, r² = 0.9318.
What do people use the Linear Regression Calculator for most?
The most common reasons people reach for it: finding the line of best fit through measurements. Quantifying how much y changes per unit of x. Predicting a value with an honest interval around it. It is built for exactly those cases rather than being a general-purpose tool with this bolted on.
When is the Linear Regression Calculator not the right tool?
This fits a straight line to two variables and assumes the scatter is roughly constant across the range and the observations independent. It does not handle curvature, several predictors, or time-ordered data where consecutive points are related. Knowing where a tool stops being trustworthy matters more than the cases where it works.
Which values should I know?
The line always passes through is the point (x̄, ȳ). What is minimised is squared VERTICAL distances, not perpendicular ones. Regressing x on y instead is gives a different line — the slopes multiply to r². These are printed on the page itself, so you do not have to take them on trust.
Is the number rounded?
The calculation runs in double precision and the result is shown to ten significant figures, so converting a value and converting it back returns the original. What is displayed is rounded for readability; what is copied is not.

Related calculators tools

All 382
01

Loan Calculator

Works out the monthly payment, total interest and full repayment schedule for any loan from…

02

EMI Calculator

Calculates your Equated Monthly Instalment with a full principal-versus-interest breakdown and…

03

Mortgage Calculator

Estimates a full monthly housing payment including principal, interest, property tax…

04

Car Loan Calculator

Calculates a car finance payment from the price, deposit, trade-in, interest rate and term…

05

Personal Loan Calculator

Works out instalments and total cost for an unsecured personal loan, including any processing…

09

SIP Calculator

Projects the maturity value of a monthly Systematic Investment Plan, showing invested amount…