How to use the linear regression calculator
Fit a least-squares line and predict y. Enter x values, y values, predict at x in the fields above; the slope, intercept, rΒ², predicted y are computed instantly and plotted on the chart so you can see how the answer changes.
Formula
Variables
- x β X values
- y β Y values
- xp β Predict at x
Worked example
With x values = 1,2,3,4,5,6, y values = 2.1,3.9,6.2,7.8,10.1,12.2, predict at x = 7, the calculator gives slope β 2.02; intercept β -0.02; rΒ² β 0.9982107; predicted y β 14.12.
Frequently asked questions
What is the formula for the linear regression calculation?
Slope = slope(x,y). Intercept = icpt(x,y). RΒ² = corr(x,y)^2. Predicted y = [Intercept]+[Slope] Γ xp. Here x is x values, y is y values, xp is predict at x.
What inputs do I need for the linear regression calculator?
You need x values, y values, predict at x. Each field is pre-filled with a typical example so you can see how the result responds as you edit the numbers.
How do I use this calculator?
Type values into the input fields. Results and the chart update instantly. Use Reset to restore the example values, Copy results to paste them elsewhere, or Share to copy a link that preserves your inputs.
Is the result exact?
Calculations use standard formulas and double-precision arithmetic, then display about seven significant figures. Real-world measurements carry uncertainty, so treat results as estimates unless your inputs are exact.