How does ordinary least squares estimate coefficients?
Reveal the answer and explore the explanation.
04MediumHigh priorityVisualHow does ordinary least squares estimate coefficients?
Answer
MediumHigh priorityVisual
How does ordinary least squares estimate coefficients?
Answer
Chooses coefficients that minimize the sum of squared residuals.
Deeper understanding
For a model ŷ = Xβ, the objective is to minimize ||y − Xβ||². With full column rank, the normal equations have a unique coefficient solution; numerical implementations typically prefer QR or SVD to explicitly inverting XᵀX. Linear regression does not require normally distributed inputs, although classical inferential assumptions matter for standard errors.
Practical example
Fit a line by penalizing large errors quadratically.
PythonRelated concept example
from sklearn.linear_model import LinearRegression
X = [[1], [2], [3]]
y = [2, 4, 6]
m = LinearRegression().fit(X, y)
print(m.predict([[4]])) # [8.]A minimal linear regression illustration; real evaluation needs held-out data.
Reference: Further reading ↗