所属模块:
M2 · 经典机器学习 (Classical Machine Learning)| 专题分类:线性回归 (Linear Regression)| 难度等级:Easy
一、核心一句话结论 (One-Sentence Summary)
线性、误差独立、同方差、误差正态(用于推断)。
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 Insights)
- 📌 异方差 → 标准误错,需稳健标准误
- 📌 自相关 → 时间序列需 GLS/Newey-West
- 📌 非线性 → 加特征/样条/树模型
English Insights:
– 1. Linearity: $E[ymid X] = Xbeta$; violation causes severe model underfitting and systematic estimation bias.
– 2. Strict Exogeneity: $E[epsilon mid X] = 0$; violation (omitted variables, measurement error, simultaneity) causes endogeneity and inconsistent $hat{beta}$.
– 3. Spherical Errors: $text{Var}(epsilon mid X) = sigma^2 I$ (homoscedasticity + no autocorrelation); violation invalidates standard errors and t-tests.
– 4. Normality of Residuals: $epsilon sim mathcal{N}(0, sigma^2 I)$; required for exact finite-sample t-tests and F-tests.
三、核心数学原理与机理推导 (Mathematical Principles & Derivation)
$$y=Xw+varepsilon,quad mathbb E[varepsilon]=0, mathrm{Var}(varepsilon)=sigma^2I$$
四大假设及违反后果:① 线性性(E[y|X]=Xw)——违反则模型系统性偏差,解法是加多项式/交互项、样条、或改用树/神经网络;② 误差独立——违反(时间自相关、空间相关、聚类)会使标准误被低估、t 检验过于乐观,解法是 GLS、Newey-West 稳健标准误、或聚类稳健标准误;③ 同方差(Var(ε)=σ² 常数)——违反时 OLS 仍无偏但不再有效(不是 BLUE),且标准误公式失效,解法是加权最小二乘(WLS)、稳健标准误、或对 y 做变换(如 log);④ 误差正态——只影响小样本推断(t/F 检验的精确性),大样本下由 CLT 保证推断有效,故这条最不关键。
📖 查看英文严格数学推导 (English Mathematical Derivation)
Impact of exogeneity violation: $hat{beta} = (X^T X)^{-1} X^T (Xbeta + epsilon) = beta + (X^T X)^{-1} X^T epsilon$. Taking expectations conditional on $X$: $E[hat{beta}mid X] = beta + (X^T X)^{-1} X^T E[epsilonmid X]$. If $E[epsilonmid X] ne 0$ (endogeneity), $hat{beta}$ is fundamentally biased and inconsistent. Impact of heteroscedasticity: Let $text{Var}(epsilonmid X) = Omega ne sigma^2 I$. The true covariance matrix is the sandwich covariance $text{Var}(hat{beta}) = (X^T X)^{-1} X^T Omega X (X^T X)^{-1}$. Using standard OLS covariance $sigma^2 (X^T X)^{-1}$ produces severely deflated standard errors, resulting in artificially tiny p-values and massive false positive discoveries.
四、工业级落地权衡与工程考量 (Industrial Trade-offs)
诊断与处理的对应:① 异方差诊断——画残差 vs 拟合值图(应无漏斗形)、Breusch-Pagan / White 检验;处理首选稳健标准误(Huber-White),因为它不改变点估计只修正推断,比变换更少假设;② 自相关诊断——Durbin-Watson 统计量、残差 ACF 图;时间序列应用 ARIMA/GLS 而非普通 OLS;③ 非线性诊断——残差 vs 特征图(应无系统模式)、RESET 检验;④ 正态性诊断——QQ 图、Shapiro-Wilk(小样本);违反时用 bootstrap 推断而非 t 检验。实践中一个常见误区是先做变换再看诊断——正确顺序是先诊断再决定是否变换,且变换会改变系数的解释(log 变换后系数是弹性)。
⚙️ 查看英文落地权衡分析 (English Systems & 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 Pitfalls & Traps)
- ⚠️ 认为 OLS 只在正态误差下才有效(大样本靠 CLT)
- ⚠️ 异方差下仍用普通标准误做检验
English Pitfalls:
– Assuming normality of raw features $X$ is an assumption of linear regression (OLS makes ZERO assumptions about the distribution of $X$, only about residuals $epsilon$).
– Ignoring cluster correlation in hierarchical data (e.g. Repeated sessions per user), causing standard errors to be underestimated by factors of 3 to 10.
六、高频深度面试追问与预测 (Follow-Up Questions)
- 如何诊断异方差?(残差图/Breusch-Pagan)
- How do White’s heteroscedasticity-consistent standard errors correct inference without modifying point estimates?
- 多重共线性如何影响系数与 p 值?
- Why does residual non-normality become practically irrelevant in large samples due to the Central Limit Theorem?
七、知识图谱对齐 (Knowledge Graph Anchor)
- 🔗 关联底层卡片:
线性回归 OLS 闭式解与 Gauss-Markov 定理(Linear Regression: OLS Normal Equation & Gauss-Markov) - 🗺️ 知识图谱模块:
经典机器学习思维导图
🔬 算法科学家与机器学习深度考察全量题库 (Science Depth)
本题收录于 TalentMe 算法科学家深度考察真题库 (Science Depth)。全库共 856 道硬核考点,深度覆盖数学统计、经典ML、深度学习、Transformer、大语言模型、多模态、推荐系统与 MLOps。支持 Jev 面经智能匹配、一键离线单文件 HTML 手册导出并直连 Obsidian 本地记忆。