Latest Results
arima: match R's coefficient standard errors
Three fixes on top of the numerical Hessian:
- Re-estimate the Hessian after maInvert re-parameterises the MA part, as
R's optim(maxit = 0, hessian = TRUE) does. The Jacobian `A` was already
evaluated at the re-parameterised coefficients while the Hessian came from
the pre-inversion fit point. On AirPassengers ARIMA(2,1,1)(0,1,0)[12] this
moves ma1's standard error from 0.03027 to 0.02919 (R: 0.02920); ar1/ar2
and the ML fit now match R to 5 decimals too.
- Marginalise the distribution parameters out of var_coef. The t/skew-normal
/ged branches sliced the arma block out of the Hessian and inverted that,
giving variances conditional on sigma2 and the shape parameter. Inverting
first and slicing after gives the marginal ones; the difference is under
1% for t and ged but understates the intercept by ~99% for skew-normal,
whose alpha is strongly correlated with the mean.
- Fold the three copies of the invert-or-NaN logic into `_coef_var`. The
transformed branch used cho_factor, which additionally rejects Hessians
that are merely indefinite and raises ValueError rather than LinAlgError
on NaN input, so it needed a separate isnan pre-check and still crashed on
the near-degenerate distribution fits.
test_coef_stderr now pins R's values (atol 2e-3 -> 1e-4) and covers ML as
well as CSS-ML; every one of these tests fails without the changes above.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119VbLrxzmn89AWrseL74fn Latest Branches
×2.2
jmoralez:perf/ets-theta-scratch-buffers 0%
-58%
© 2026 CodSpeed Technology