M2-002M2: Classical Machine LearningLinear RegressionEasy
⚡Flashcard Drill➔Mastery:
Enumerate the Four Classical Assumptions of Linear Regression and the Consequences of Their Violation
📐 Mathematical Definition
⚡ One-Sentence Core Answer
The classical OLS assumptions are Linearity, Exogeneity (zero conditional mean of errors), Homoscedasticity (constant error variance with zero autocorrelation), and Residual Normality; violations cause coefficient bias, deflated standard errors, and invalid p-values.
📌 Key Takeaways
- •1. Linearity: ; violation causes severe model underfitting and systematic estimation bias.
- •2. Strict Exogeneity: ; violation (omitted variables, measurement error, simultaneity) causes endogeneity and inconsistent .
- •3. Spherical Errors: (homoscedasticity + no autocorrelation); violation invalidates standard errors and t-tests.
- •4. Normality of Residuals: ; required for exact finite-sample t-tests and F-tests.
📐 Mathematical Derivations
Impact of exogeneity violation: . Taking expectations conditional on : . If (endogeneity), is fundamentally biased and inconsistent. Impact of heteroscedasticity: Let . The true covariance matrix is the sandwich covariance . Using standard OLS covariance produces severely deflated standard errors, resulting in artificially tiny p-values and massive false positive discoveries.
🏭 Production Trade-offs
Industrial diagnostics and remediations: (1) Heteroscedasticity: Diagnosed via Breusch-Pagan test or residual-vs-fitted plots; resolved by using Huber-White heteroscedasticity-robust standard errors (HC1/HC3). (2) Endogeneity: Resolved via Instrumental Variables (2SLS) or fixed-effects panel models. (3) Non-linearity: Resolved via polynomial features, splines, or switching to tree-based ensembles (GBDT).
⚠️ Common Interview Pitfalls
- ✕Assuming normality of raw features is an assumption of linear regression (OLS makes ZERO assumptions about the distribution of , only about residuals ).
- ✕Ignoring cluster correlation in hierarchical data (e.g. Repeated sessions per user), causing standard errors to be underestimated by factors of 3 to 10.
🎯 Interviewer Follow-up Inquiries
- ?How do White's heteroscedasticity-consistent standard errors correct inference without modifying point estimates?
- ?Why does residual non-normality become practically irrelevant in large samples due to the Central Limit Theorem?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚
Associated Knowledge Base Guides & Mindmaps
Explore the comprehensive technical article, exam cards, and global architecture tree.
中文速览与面试要点
列举线性回归的四大假设,并说明违反后果。
线性、误差独立、同方差、误差正态(用于推断)。
核心要点
- 四大假设及违反后果:① 线性性 (E[y|X]=Xw)——违反则模型系统性偏差,解法是加多项式/交互项、样条、或改用树/神经网络;② 误差独立 ——违反(时间自相关、空间相关、聚类)会使标准误被低估、t 检验过于乐观,解法是 GLS、Newey-West 稳健标准误、或聚类稳健标准误;③ 同方差 (Var(ε)=σ² 常数)——违反时 OLS 仍无偏但 不再有效 (不是 BLUE),且标准误公式失效,解法是加权最小二乘(WLS)、稳健标准误、或对 y 做变换(如 log);④ 误差正态 ——只影响 小样本推断 (t/F 检验的精确性),大样本下由 CLT 保证推断有效,故这条最不关键。
- 诊断与处理的对应:① 异方差诊断 ——画残差 vs 拟合值图(应无漏斗形)、Breusch-Pagan / White 检验;处理首选 稳健标准误 (Huber-White),因为它不改变点估计只修正推断,比变换更少假设;② 自相关诊断 ——Durbin-Watson 统计量、残差 ACF 图;时间序列应用 ARIMA/GLS 而非普通 OLS;③ 非线性诊断 ——残差 vs 特征图(应无系统模式)、RESET 检验;④ 正态性诊断 ——QQ 图、Shapiro-Wilk(小样本);违反时用 bootstrap 推断而非 t 检验。实践中一个常见误区是 先做变换再看诊断 ——正确顺序是先诊断再决定是否变换,且变换会改变系数的解释(log 变换后系数是弹性)。
- 异方差 → 标准误错,需稳健标准误
- 自相关 → 时间序列需 GLS/Newey-West
- 非线性 → 加特征/样条/树模型
常见陷阱
- 认为 OLS 只在正态误差下才有效(大样本靠 CLT)
- 异方差下仍用普通标准误做检验