Minimize squared residuals
A residual is observed y minus the line’s predicted value. The least-squares objective sums the squared residuals over all observations and depends on slope and intercept.
jbstatistics · YouTube · 12:13
Derive simple linear regression’s least-squares slope and intercept from the normal equations.
Use the learning inspector for key ideas and moments, or open the reading tabs for the complete notes.
Generated from the video's visuals and explanation; not verbatim speech.
A residual is observed y minus the line’s predicted value. The least-squares objective sums the squared residuals over all observations and depends on slope and intercept.
Setting the intercept derivative to zero gives intercept=mean(y)−slope·mean(x). Hence a fitted line with an intercept passes through the point of sample means.
The slope is Σ[(xᵢ−x̄)(yᵢ−ȳ)] divided by Σ(xᵢ−x̄)², provided the denominator is positive. If all x values are identical, the usual unique slope formula is unavailable.
A residual is observed y minus the line’s predicted value. The least-squares objective sums the squared residuals over all observations and depends on slope and intercept.
Setting the intercept derivative to zero gives intercept=mean(y)−slope·mean(x). Hence a fitted line with an intercept passes through the point of sample means.
The slope is Σ[(xᵢ−x̄)(yᵢ−ȳ)] divided by Σ(xᵢ−x̄)², provided the denominator is positive. If all x values are identical, the usual unique slope formula is unavailable.
A residual is observed y minus the line’s predicted value. The least-squares objective sums the squared residuals over all observations and depends on slope and intercept. Setting the intercept derivative to zero gives intercept=mean(y)−slope·mean(x). Hence a fitted line with an intercept passes through the point of sample means. The slope is Σ[(xᵢ−x̄)(yᵢ−ȳ)] divided by Σ(xᵢ−x̄)², provided the denominator is positive. If all x values are identical, the usual unique slope formula is unavailable.
The least-squares objective function sums the squared residuals over all observations. A residual is defined as the observed y value minus the line’s predicted value.
Conditions: The model is simple linear regression.; Residuals are defined as observed y minus predicted y.
By setting the partial derivative of the least-squares objective with respect to the intercept to zero, we obtain the relationship: intercept = mean(y) − slope · mean(x). This implies that the fitted line always passes through the point of sample means.
Conditions: The model includes an intercept term.; The derivative is taken with respect to the intercept parameter.
The least-squares slope is calculated as the sum of the products of centered x and y values, divided by the sum of squared centered x values. Mathematically, this is .
Conditions: The denominator is positive.; The model is simple linear regression with an intercept.
The unique slope formula is unavailable if all x values are identical. In this case, the denominator of the slope formula, which is the sum of squared deviations of x from its mean, becomes zero.
Conditions: All observed x values are identical.; The model attempts to fit a line with a unique slope.