F2-conf-03 — Coverage of OLS confidence intervals, n = 30, heteroskedastic errors
Question
In the fixed-design model y_i = 1 + 0.5 x_i + σ_i ε_i (n = 30, ε_i iid N(0,1), x and σ fixed from data/design.csv), what is the true coverage of nominal 95% intervals β̂ ± t_{0.975}(28)·se for (a) the conventional OLS SE and (b) the HC1 robust SE? Also: (c) the exact SD of β̂, (d) E[se_conv]. Does the conventional interval reach 95%?
Data and exclusions
data/design.csv: 30 rows read and 30 used. There were no missing values, σ was always positive, and nothing was excluded. In this design σ_i grows with |x_i|: it ranges from 0.60 near x = 0 to 1.79 at x = 1.99. This is the kind of heteroskedasticity that makes the conventional SE too small.
Method
- Exact SD (c): β̂ = Σ w_i y_i, where w is the slope row of (X'X)⁻¹X'. So Var(β̂) = Σ w_i² σ_i². This is analytic, with no simulation.
- Monte Carlo (a, b, d): R = 2000 replications, using
numpy.random.default_rng(20261030). Only ε is redrawn in each replication.- se_conv² = s²·[(X'X)⁻¹]₂₂, where s² = RSS/(n−2).
- se_HC1² = (n/(n−2))·Σ w_i² e_i², i.e. the HC0 sandwich scaled by n/(n−2).
- Critical value: t_{0.975}(28) = 2.0484.
- Coverage is the share of replications with |β̂ − 0.5| ≤ t·se.
- Check against statsmodels: for one sample, the SE formulas matched statsmodels' OLS SE and HC1 SE to machine precision.
- Decision rule: the conventional interval "undercovers" if its coverage is below 0.95 − 3·MCSE, where MCSE = √(p̂(1−p̂)/R) is evaluated at the estimated coverage. Evaluating it at p = 0.95 instead gives MCSE 0.0049, and the conclusion stays the same.
Results
| Quantity | Value |
|---|---|
| Coverage, conventional CI | 0.844 |
| Coverage, HC1 CI | 0.902 |
| Exact SD of β̂ | 0.2680 |
| MC SD of β̂ (R−1 divisor) | 0.2696 |
| Mean se_conv | 0.1903 |
| Mean se_HC1 (diagnostic) | 0.2408 |
| Mean β̂ (diagnostic) | 0.4962 |
The conventional SE is badly biased downward. On average it is about 0.190, against a true SD of 0.268, so it understates the SD by roughly 29%. As a result, the conventional interval covers only about 84% of the time. Its shortfall from 95% is 10.6 percentage points, about 13 MCSEs, so conventional_ci_undercovers = true: the conventional interval does not attain its nominal 95% coverage.
HC1 does much better, at about 90%. It still undercovers, though. At n = 30 the robust SE is itself biased downward (mean 0.241 vs 0.268) and noisy, especially here, where the observations with the largest variance also have high leverage. The MC SD of β̂ agrees with the exact value to within simulation error, which supports the correctness of the simulation.
Uncertainty
Binomial Monte Carlo standard errors at R = 2000:
- Conventional coverage: 0.844, MCSE 0.0081, approximate 95% MC interval [0.828, 0.860].
- HC1 coverage: 0.902, MCSE 0.0067, approximate 95% MC interval [0.889, 0.915].
- MCSE at the nominal 0.95: 0.0049.
The MC SD of β̂ has a relative standard error of about 1/√(2R) ≈ 1.6%. All of these values are reproducible with seed 20261030; a different seed would change them within these MC errors.
Limitations and open issues
- The results hold for this single fixed design and for normal errors only. They should not be generalised to other x/σ configurations or to other sample sizes.
- HC1 was not compared with HC2/HC3 or with wild-bootstrap intervals. Those might bring coverage closer to 95%, but they were outside the task.
- R = 2000 limits coverage precision to about ±1.6 percentage points (2·MCSE).
- Additional diagnostics are written to
out/diagnostics.json. They are not part of the required results.