PS 818 - Data Analysis with Statistical Models
September 9, 2026
\[ \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator*{\argmax}{arg\,max} \]
.qmd + rendered .html; submit both on Gradescope.rstan/brms)
All models are wrong, but some are useful.
— George Box (1976)
Consider the ordinary least squares estimator \(\hat{\beta}\), which solves the minimization problem
\[\hat{\beta} = \argmin_b \ \sum_{i=1}^n (Y_i - X_i b)^2\]
We can do some algebra and find a closed form solution for this optimization problem
\[\hat{\beta} = (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}Y)\]
Assumption 1: Linearity
\[Y = \mathbf{X}\beta + \epsilon\]
Assumption 2: Strict exogeneity of the errors
\[\mathbb{E}[\epsilon | \mathbf{X}] = 0\]
These two imply a linear CEF
\[\mathbb{E}[Y|\mathbf{X}] = \mathbf{X}\beta = \beta_0 + \beta_1X_{1} + \beta_2X_{2} + \dotsc + \beta_kX_{k}\]
Best case: our CEF is truly linear (by luck, or because we have a saturated model)
Usual case: Assumption 2 fails and the CEF is not linear
\[\begin{align*}\hat{\beta} &= (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}Y)\\ &= (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}(\mathbf{X}\beta + \epsilon))\\ &= (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}\mathbf{X})\beta + (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}\epsilon)\\ &= \beta + (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}\epsilon) \end{align*}\]
\[\begin{align*} \mathbb{E}[\hat{\beta} | \mathbf{X}] &= \mathbb{E}\bigg[\beta + (\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}\epsilon) \bigg| \mathbf{X} \bigg]\\ &= \mathbb{E}[\beta | \mathbf{X}] + \mathbb{E}[(\mathbf{X}^{\prime}\mathbf{X})^{-1}(\mathbf{X}^{\prime}\epsilon) | \mathbf{X}]\\ &= \beta + (\mathbf{X}^{\prime}\mathbf{X})^{-1}\mathbf{X}^{\prime} \mathbb{E}[\epsilon | \mathbf{X}]\\ &= \beta + (\mathbf{X}^{\prime}\mathbf{X})^{-1}\mathbf{X}^{\prime}0\\ &= \beta \end{align*}\]
Lastly, by the law of total expectation
\[\mathbb{E}[\hat{\beta}] = \mathbb{E}[\mathbb{E}[\hat{\beta}|\mathbf{X}]]\]
Therefore
\[\mathbb{E}[\hat{\beta}] = \mathbb{E}[\beta] = \beta\]
For consistency, we just need to stabilize by \(\frac{1}{n}\), since \(\mathbf{X}^{\prime}\mathbf{X}\) diverges as \(n\) grows
\[\hat{\beta} - \beta = \left(\frac{1}{n}\mathbf{X}^{\prime}\mathbf{X}\right)^{-1}\left(\frac{1}{n}\mathbf{X}^{\prime}\epsilon\right) \overset{p}{\to} \mathbf{Q}^{-1} \cdot 0 = 0\]
We need \(\mathbf{Q} = \mathbb{E}[X_iX_i^{\prime}]\) to be invertible – the population version of no perfect collinearity
And we need \(\frac{1}{n}\mathbf{X}^{\prime}\epsilon \overset{p}{\to} 0\) – which requires only \(\mathbb{E}[X_i\epsilon_i] = 0\), weaker than the full \(\mathbb{E}[\epsilon | \mathbf{X}] = 0\).
Notice what we still have not assumed: anything about the shape of the error distribution.
Assumption 4 – Spherical errors
\[Var(\epsilon | \mathbf{X}) = \begin{bmatrix} \sigma^2 & 0 & \cdots & 0\\ 0 & \sigma^2 & \cdots & 0\\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \sigma^2 \end{bmatrix} = \sigma^2 \mathbf{I}\]
Benefits
Drawbacks
We can relax homoskedasticity (but still keep no correlation) and do inference on the variance of \(\hat{\beta}\)
\[Var(\epsilon | \mathbf{X}) = \begin{bmatrix} \sigma^2_1 & 0 & \cdots & 0\\ 0 & \sigma^2_2 & \cdots & 0\\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \sigma^2_n \end{bmatrix}\]
“Robust” standard errors using the Eicker-Huber-White “sandwich” estimator – consistent but not unbiased for the true sampling variance of \(\hat{\beta}\)
\[\widehat{Var(\hat{\beta})} = (\mathbf{X}^{\prime}\mathbf{X})^{-1} \mathbf{X}^{\prime}\hat{\Sigma}\mathbf{X}(\mathbf{X}^{\prime}\mathbf{X})^{-1}\]
\(\hat{\Sigma}\) is our estimate of the variance-covariance matrix, using the squared residuals on the diagonal
Extensions to “clustered” standard errors allow arbitrary correlation within groups.
Assumption 5 – Normality of the errors
\[\epsilon | \mathbf{X} \sim \mathcal{N}(0, \sigma^2\mathbf{I})\]
Not necessary even for the Gauss-Markov result
Not needed to do asymptotic inference on \(\hat{\beta}\)
Benefits?
And: this is the assumption that turns OLS into a likelihood model.
PS 818 - University of Wisconsin-Madison