Least squares chooses the coefficients of a linear regression so that the total of squared residuals is as small as possible. A residual is the gap between an observed y and the value predicted by the fitted line. Ordinary least squares (OLS) uses equal weight for every observation.
Least squares chooses the coefficients of a linear regression so that the total of squared residuals is as small as possible. A residual is the gap between an observed y and the value predicted by the fitted line. Ordinary least squares (OLS) uses equal weight for every observation.
Four constructed pairs (x, y): (1, 3), (2, 5), (3, 6), (4, 8). The OLS line computed from these points is ŷ = 1.5 + 1.6x (calculation on the next page). At x = 2 the line predicts 4.7, while the observed y is 5, so the residual is 0.3.
A simple linear regression is written
y = β0 + β1x + ε
After fitting, the estimated intercept and slope are written β̂0 and β̂1. The fitted (predicted) value is ŷ = β̂0 + β̂1x. The residual is e = y − ŷ. The residual is the sample leftover; the error ε is the theoretical term in the model. They are related ideas, not identical names.
OLS chooses β̂0 and β̂1 so that Σ ei2 is minimized. Squaring treats over- and under-prediction equally and penalises large misses more than small ones. Other methods (GLS, WLS) change the weights; they still start from this residual idea.
Use the constructed pairs (1, 3), (2, 5), (3, 6), (4, 8). n = 4, Σx = 10, Σy = 22, x̄ = 2.5, ȳ = 5.5, Σxy = 63, Σx2 = 30.
Slope: β̂1 = (n Σxy − (Σx)(Σy)) / (n Σx2 − (Σx)2) = (4×63 − 10×22) / (4×30 − 102) = (252 − 220) / (120 − 100) = 32 / 20 = 1.6.
Intercept: β̂0 = ȳ − β̂1 x̄ = 5.5 − 1.6×2.5 = 1.5.
Interpretation: each extra unit of x is associated with a 1.6 unit rise in fitted y, on this tiny teaching set. The intercept 1.5 is the fitted value at x = 0; here x = 0 is outside the observed range, so treat 1.5 as an algebraic intercept, not a real-world claim.
The same four constructed points. Expected display: intercept near 1.5 and slope near 1.6, plus a scatter with the fitted line. Do not treat software rounding as a new exam number.