calculator.onl
Categories50

Linear regression and residuals

Three points stay fixed. Move the fourth from (4, 4) to (4, 8) and the fitted line tilts. At x = 5 the prediction moves from 5 to 9.

A worked example

ŷ(x*) 6.7 · b 0.9
Enter one x y pair per line. Fit an ordinary least-squares line, inspect residuals and estimate y at a chosen x.

x*: -1000000000…1000000000

Updates as you type

Use a dot or comma for decimals. No thousands separators.

YOUR RESULT

b

0.9

Calculated from your inputs

a1.3
R²0.81
SSE1.9
ŷ(x*)6.7
s (e)0.7958
n5
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

Enter one x y pair per line. Fit an ordinary least-squares line, inspect residuals and estimate y at a chosen x. For a related calculation, try Variance, Standard Deviation & MAD Calculator.

What to enter

InputWhat it meansExample value
x ; yEnter one x y pair per line. Fit an ordinary least-squares line, inspect residuals and estimate y at a chosen x.1 1 2 2 3 3 4 4
x*x*: -1000000000…1000000000 5

How the calculation works

  1. Enter one x y pair per line. Fit an ordinary least-squares line, inspect residuals and estimate y at a chosen x.
  2. b=Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; a=ȳ−bx̄; eᵢ=yᵢ−(a+bxᵢ); R²=1−SSE/SST
  3. 2–500 pairs with decimal points. Constant x is invalid; constant y has undefined R². Residual standard deviation requires at least three points. No causality or prediction interval.
The formulab=Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; a=ȳ−bx̄; eᵢ=yᵢ−(a+bxᵢ); R²=1−SSE/SST

A worked example

ŷ(x*) · x = 5 · 1 × 5 = 5 → 2.2 × 5 − 2 = 9

Example you can load

What to enter
Result for this example · b1
Result for this example · ŷ(x*)5

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

2–500 pairs with decimal points. Constant x is invalid; constant y has undefined R². Residual standard deviation requires at least three points. No causality or prediction interval.

Reference ·

Frequently asked questions

Linear regression and residuals — How is the result calculated?

b=Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; a=ȳ−bx̄; eᵢ=yᵢ−(a+bxᵢ); R²=1−SSE/SST

x ; y / x*?

Enter one x y pair per line. Fit an ordinary least-squares line, inspect residuals and estimate y at a chosen x.

Linear regression and residuals — What assumptions apply?

2–500 pairs with decimal points. Constant x is invalid; constant y has undefined R². Residual standard deviation requires at least three points. No causality or prediction interval.