SPB Git

spb/wp29_uqo

Public
6.0 KB · 49 lines markdown
1# F5-conf-02 — Finite-sample bias of OLS ρ̂ in a Gaussian AR(1)23## Question4In the Gaussian AR(1) y_t = c + ρ y_{t−1} + ε_t, ε_t ~ N(0, σ²), OLS of y_t on (1, y_{t−1}) is biased downward in small samples. We compare the Marriott–Pope/Kendall approximation E[ρ̂] − ρ ≈ −(1+3ρ)/n with a Monte Carlo estimate of the actual bias at the design n = 30, ρ = 0.8 (`design_n`, `design_rho`).56## Data and exclusions7The only input is `data/design.csv` (7 rows, `n_input_rows`; SHA-256 in `design_sha256`): n = 30, ρ = 0.8, σ = 1 (`design_sigma`), intercept included, stationary initial condition, R = 20000 replications (`n_replications`), seed 20261029 (`random_seed`). No data problems were found (`data_issues` is empty). One exclusion rule (drop replications with a non-finite ρ̂) removed 0 replications, so `n_analysed` = 20000 (`out/exclusions.csv`).89## Method10- **Analytical approximation** (`bias_analytical`): −(1+3ρ)/n with n = 30, the series length given in the design. This formula is the leading term of an asymptotic expansion of E[ρ̂] in powers of 1/n, derived for a stationary Gaussian AR(1) with an estimated mean/intercept. Its error is O(n⁻²), so it is accurate *as n → ∞* (relative error shrinks like 1/n). It is not an exact finite-sample result and gives no guarantee at any fixed n, especially when ρ is near 1, where higher-order terms are larger. Because the regression actually uses n − 1 = 29 pairs, and both n and n − 1 are consistent with the same first-order expansion, I also report the formula evaluated at n − 1 as a sensitivity check (`bias_analytical_neff`).11- **Monte Carlo** (`bias_mc`): for each of R = 20000 replications, y_1 ~ N(0, σ²/(1−ρ²)), then y_t = 0.8 y_{t−1} + ε_t for t = 2…30 (c = 0). ρ̂ is the OLS slope of y_t on (1, y_{t−1}) for t = 2…30. One (R × n) standard-normal matrix is drawn from `numpy.random.default_rng(20261029)`. bias_mc = mean(ρ̂) − ρ; its MC standard error is sd(ρ̂)/√R (`bias_mc_se`). Baseline reference: the textbook asymptotic SE √((1−ρ²)/n) (`se_asymptotic`).12- Checks: a statsmodels OLS fit reproduces the first replications exactly, and a clean re-run gives byte-identical output (`out/state/checks.md`).1314## Results15| quantity | value | key |16|---|---|---|17| Analytical bias −(1+3ρ)/n | −0.1133 | `bias_analytical` |18| MC bias | −0.1223 | `bias_mc` |19| MC SE of bias | 0.00105 | `bias_mc_se` |20| mean ρ̂ | 0.6777 | `rho_hat_mean` |21| median ρ̂ | 0.6990 | `rho_hat_median` |22| sd ρ̂ across replications | 0.1479 | `rho_hat_sd_mc` |23| asymptotic SE √((1−ρ²)/n) | 0.1095 | `se_asymptotic` |24| (bias_mc − bias_analytical)/SE | −8.61 | `discrepancy_se_units` |25| MC bias / analytical bias | 1.079 | `bias_ratio_mc_to_analytical` |26| analytical bias using n−1 = 29 | −0.1172 | `bias_analytical_neff` |27| discrepancy vs n−1 version (SE units) | −4.88 | `discrepancy_se_units_neff` |2829Interpretation:30- **Size and direction of the bias.** The OLS estimator is clearly biased downward. On average ρ̂ is about 0.68 rather than 0.8, a bias of −0.122 (`bias_mc`). That is larger than the asymptotic SE itself (`se_asymptotic` = 0.110). About 79% of the ρ̂ values fall below the true ρ (`share_rho_hat_below_rho`).31- **How well the approximation does.** It gets the sign and most of the size right: the actual bias is about 8% larger than predicted (`bias_ratio_mc_to_analytical` = 1.079).32- **The gap is real, not simulation noise.** The difference is −8.6 MC standard errors (`discrepancy_se_units`). Even with n − 1 in the formula, the gap is still −4.9 SE (`discrepancy_se_units_neff`).33- **Why the gap is expected.** A first-order O(1/n) approximation should leave a remainder of order 1/n². With n = 30 and ρ = 0.8, a remainder of about −0.009 is consistent with that. The gap is statistically significant but small in substantive terms. It does not show that the formula is "wrong"; it is the expected size of the higher-order terms.34- **Spread of ρ̂.** The sampling sd of ρ̂ is 1.35 times the asymptotic SE (`sd_ratio_mc_to_asymptotic`). The distribution is left-skewed: its 2.5%–97.5% range is 0.331 to 0.902 (`rho_hat_q025`, `rho_hat_q975`). So first-order asymptotics also understate the dispersion at this design.3536## Uncertainty37The MC standard error of the bias is 0.00105 (`bias_mc_se`), giving a 95% interval for the true finite-sample bias of [−0.1244, −0.1203] (`bias_mc_ci95`). This interval excludes the analytical value −0.1133 (`bias_analytical`) and also its n−1 version −0.1172 (`bias_analytical_neff`). The analytical quantities are deterministic and have no sampling uncertainty. The results are exact for the fixed seed; a different seed would move `bias_mc` by roughly ±0.002 (2 × `bias_mc_se`).3839## Limitations and open issues40- **What the analytical formula is.** −(1+3ρ)/n is a first-order asymptotic (large-n) approximation to the mean bias, with an O(n⁻²) remainder. It is accurate in the sense that its relative error vanishes as n grows. It carries no exact finite-sample guarantee, and its accuracy gets worse as ρ → 1 and as n gets smaller.41- **What the Monte Carlo can establish.** It estimates the bias at exactly one design point: n = 30, ρ = 0.8, Gaussian errors, stationary start, intercept included, c = 0. It cannot establish:42  - the approximation's accuracy at other (n, ρ) values;43  - behaviour with non-Gaussian errors or non-stationary starting values;44  - the general size of the higher-order terms.4546  Making such claims would need a grid of designs or analytical higher-order expansions, which this task did not require.47- **Ambiguity in "n".** Whether n in the formula means the series length (30) or the number of regression pairs (29) is a matter of convention. I used 30 as the task specifies, and both versions are reported. Neither version falls within the MC confidence interval.48- **Mean bias only.** The bias is a statement about the mean. Because the ρ̂ distribution is skewed, the median bias (`rho_hat_median` − 0.8 ≈ −0.10) differs from the mean bias.49
Files · main
Menu

Theme