The idea
Linear regression models the target as a weighted sum of features plus noise:
OLS picks the minimizing the sum of squared residuals. It is the interview workhorse because every part of it can be probed:
Assumptions — know them in two tiers.
- For unbiased coefficients: linearity in parameters, and exogeneity ( — no omitted confounders driving both and ).
- For valid inference (SEs, t-tests, CIs): independent errors, homoscedasticity (constant error variance), and normal errors for exact small-sample tests. Plus no perfect multicollinearity, or does not exist at all.
The distinction is the interview point: heteroscedasticity does not bias — it invalidates the error bars. Prediction survives many violations that kill inference.
Coefficients. = expected change in for a one-unit increase in , holding the other features fixed — a partial effect, not a marginal one, which is why coefficients shift when you add or remove correlated features. With , effects become multiplicative: per unit of .
Multicollinearity. Correlated features make nearly singular: the data cannot tell which of the twins deserves the credit. Detection: , where comes from regressing on the other features; VIF - is the usual alarm, and inflates by . Remedies: drop or combine the redundant features, ridge regression, or PCA. Predictions are mostly fine; coefficient stories are not.
Scoreboards.
never drops when you add a feature — even noise — so adjusted (or CV error) is the honest comparator across model sizes. RMSE () amplifies large errors; MAE () treats them linearly and resists outliers.
Worked example
Apartment prices (in thousands of dollars) modeled on size and rooms:
- Interpretation: among apartments with the same number of rooms, one extra square meter is associated with a $900 higher price. The intercept ($50k at zero size, zero rooms) is an extrapolation artifact, not a real apartment.
- Multicollinearity: sqm and rooms are strongly correlated. Regressing sqm on rooms gives , so : the standard error of each twin coefficient is times what it would be with uncorrelated features. Drop rooms, and the sqm coefficient will jump (it absorbs the room effect) — same predictions, different story.
- Adjusted : with , features and :
Ten features bought a headline 0.60, but after the parameter tax the explanatory power is closer to half the variance.
- RMSE vs MAE: test residuals in $k give and . One bad miss barely moves MAE but pushes RMSE to nearly 1.5x the MAE — exactly the sensitivity you want if large errors are what cost you, and exactly the distortion you do not want if that residual is a data glitch.
Cheat sheet
Estimator: — exists iff no perfect multicollinearity.
Assumptions ladder: linearity + exogeneity → unbiased ; add independence + homoscedasticity → valid SEs (Gauss-Markov: OLS is BLUE); add normal errors → exact t/F tests.
| Symptom | Likely violation | Standard fix |
|---|---|---|
| Curved residual-vs-fitted plot | non-linearity | transforms, polynomial/interaction terms |
| Residual fan (spread grows with fit) | heteroscedasticity | robust (White) SEs, log-transform , WLS |
| Residuals autocorrelated (time series) | dependent errors | Newey-West SEs, time-series models |
| Huge SEs, sign-flipping coefficients | multicollinearity | VIF check, drop/combine, ridge, PCA |
| Coefficient changes when adding a control | correlated features / confounding | expected — interpret as partial effects |
Metrics: (train: never falls with more features; test: can be negative). . RMSE punishes outliers quadratically; MAE linearly.
- VIF; VIF 10 ⇒ SE inflated x.
- model: coefficient ⇒ multiply by ( for small ).
- Multicollinearity hurts inference, not (in-distribution) prediction.
- Gauss-Markov does not require normality — normality is only for exact finite-sample tests.
- Comparing models with different : adjusted , AIC/BIC, or CV — never raw train .