Advertisement

Linear regression calculator

Enter matching predictor and response lists to fit the model and predict at a chosen x value.

Calculator

Predicted response
5.166667
R squared
0.964286
Residual sum of squares
0.166667
Residual degrees of freedom
1.000000
Residual standard deviation
0.408248
Coefficients in original x units
CoefficientEstimate
b00.666667
b11.500000
Fitted observations
xObserved yPredicted yResidual
1.0000002.0000002.166667-0.166667
2.0000004.0000003.6666670.333333
3.0000005.0000005.166667-0.166667

Advertisement

How this calculator works

Fit a straight line with an intercept by ordinary least squares. Every pair receives equal weight. The slope gives the fitted change in y for a unit increase in x. Residuals use observed minus predicted response. Residual standard deviation uses n - 2 degrees of freedom. Constant x values do not identify a slope.

Formula

ŷ = b0 + b1x; minimise Σ(y - ŷ)². b1 = Σ((x - x̄)(y - ȳ))/Σ(x - x̄)²; b0 = ȳ - b1x̄.

Worked example

Pairs (1,2), (2,4), (3,5) give slope 1.5 and intercept 2/3. At x = 4, the prediction is 6 2/3; SSE is 1/6.

Advertisement

Frequently asked questions

What does the intercept mean?

It is the fitted response at x = 0. That value may lie outside the useful data range.

Is correlation the slope?

No. Slope has units of y per x, while correlation is dimensionless.

Can I extrapolate?

The formula can predict outside the observed range, but the relationship may fail there. Use subject knowledge.

Sources

Advertisement