Skip to content

ENH: add fixed_params support to innovations_mle (Issue#6159) - #9845

Merged
bashtage merged 2 commits into
statsmodels:mainfrom
imann128:fix/innovations-mle-fixed-params
Jul 23, 2026
Merged

bashtage merged 2 commits into
statsmodels:mainfrom
imann128:fix/innovations-mle-fixed-params

Conversation

@imann128

Copy link
Copy Markdown
Contributor

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.

@imann128
imann128 marked this pull request as draft June 15, 2026 12:59
@imann128
imann128 force-pushed the fix/innovations-mle-fixed-params branch from 4443771 to a0ed283 Compare June 15, 2026 13:11
@imann128
imann128 marked this pull request as ready for review June 15, 2026 16:15
@imann128 imann128 changed the title ENH: add fixed_params support to innovations_mle (GH#6159) ENH: add fixed_params support to innovations_mle (Issue#6159) Jun 15, 2026
@imann128 imann128 closed this Jun 15, 2026
@imann128 imann128 reopened this Jun 15, 2026
@imann128 imann128 closed this Jun 15, 2026
@imann128 imann128 reopened this Jun 15, 2026
@Aniketsy

Copy link
Copy Markdown
Contributor

@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

@imann128

Copy link
Copy Markdown
Contributor Author

@Aniketsy Oh, I am so sorry. Yes, I was doing it to re-run the CI. I won't do it now.

@ChadFulton

Copy link
Copy Markdown
Member

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.

@imann128

Copy link
Copy Markdown
Contributor Author

@ChadFulton can I get an update, please?

@bashtage

Copy link
Copy Markdown
Member

@ChadFulton Any chance you could look at this?

@ChadFulton

Copy link
Copy Markdown
Member

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 enforce_invertibility=False). When using fixed parameters, two aspects to be aware of are:

  1. The model enforces stationarity (and optionally MA invertibility) by using a transformation that maps arbitrary parameters into a space of parameters that satisfy the constraint. Any parameters that are given as fixed are then overwritten after that transformation is performed, which means that it is not possible to guarantee that the final parameter vector will satisfy the constraint.
  2. One way to mitigate this is to specify the entire set of AR coefficients (in which case you can guarantee that they satisfy stationarity) or the entire set of MA coefficents. In this way, the remaining coefficients could be estimated and the transformation would ensure the appropriate conditions are met.

@imann128

Copy link
Copy Markdown
Contributor Author

Thank you!

I have added the docstring too.

@bashtage
bashtage merged commit 57636a2 into statsmodels:main Jul 23, 2026
10 checks passed
@bashtage

Copy link
Copy Markdown
Member

Thanks for the quick follow-up.

@imann128
imann128 deleted the fix/innovations-mle-fixed-params branch July 25, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants