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.