All simulators
OLS by Matrices
Simulated data with X′X, (X′X)⁻¹, β̂, s² and standard errors computed live from the matrix formulas.
Day 27: OLS in Matrix FormdataOLS fittrue line y = 1 + β₁x
X′X = [20.00096.66696.666546] X′y = [104555]
(X′X)⁻¹ = [0.346-0.061-0.0610.013]
β̂ = (X′X)⁻¹X′y = [2.1510.636]
s²
2.334
true σ² = 2.25
SE(β̂₁)
0.1720
t = β̂₁/SE
3.70
95% CI for β₁: [0.276, 0.996]
Every number on the right is computed from the matrices: β̂ = (X′X)⁻¹X′y, s² = e′e/(n − k), Var(β̂) = s²(X′X)⁻¹. Spread out x or add data and watch (X′X)⁻¹, and with it the standard errors, shrink.