Repository navigation
ENH: add fixed_params support to innovations_mle (Issue#6159) - #9845
Conversation
4443771 to
a0ed283
Compare
|
@imann128 i'm not getting why you're closing and opening PR, is this due to ci fail, please avoid doing this, if ci -fails looks unrelated |
|
@Aniketsy Oh, I am so sorry. Yes, I was doing it to re-run the CI. I won't do it now. |
|
Thank you very much for this pull request! I'll have time to review this next weekend. Please feel free to ping me next Monday if I haven't gotten back to you. |
|
@ChadFulton can I get an update, please? |
|
@ChadFulton Any chance you could look at this? |
|
It looks good to me, thanks! It might be worth adding a note to the docstring that makes the following points: The innovations algorithm requires a stationary process (and by default also requires an invertible MA component, though that can be relaxed by setting
|
|
Thank you! I have added the docstring too. |
|
Thanks for the quick follow-up. |
Summary
Related to Issue #6159
The innovations_mle estimator in statsmodels/tsa/arima/estimators/innovations.py did not support fixed parameters, even though this is available in hannan_rissanen and noted as a TODO in the source. The issue is tracked in the ARIMA estimators enhancement issue.
What was changed
innovations.py:Added fixed_params=None parameter to innovations_mle
Imported _validate_fixed_params from hannan_rissanen (already a dependency) to reuse existing validation logic
After the spec is built, fixed_params is validated and three index structures are computed: fixed_ix, free_ix, and fixed_vals
The optimizer only receives and operates over free parameters. Inside the objective function, the full parameter vector is reconstructed by constraining the free params via spec.constrain_params, then overwriting fixed positions with user-supplied values directly — bypassing the transformation since user-supplied values are already in constrained space
The same reconstruction is applied after optimization to set the final p.params
Removed the TODO comment for fixed params
test_innovations.py:test_innovations_mle_fixed_params_ar — AR param held exactly, free params differ from unconstrained solution
test_innovations_mle_fixed_params_ma — MA param held exactly
test_innovations_mle_fixed_params_both — both AR and MA fixed, sigma2 still optimized
test_innovations_mle_fixed_params_statespace — LLF from innovations_mle matches Kalman filter LLF at the same params
test_innovations_mle_fixed_params_no_fixed — None and {} reproduce baseline behavior
test_innovations_mle_fixed_params_invalid — sigma2, out-of-spec lag, and invalid key all raise ValueError
Note for reviewer:
**_validate_fixed_params**is currently private to hannan_rissanen.py and is imported from there. If preferred, it could be moved to a shared utility module to avoid cross-importing between estimator files.