Repository navigation
Conversation
This was referenced Nov 23, 2026
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 25, 2026
The `versionchanged` note of the `complex_step` argument also says that the results no longer initialize the state again without complex step, which made the derivatives of the first period of the smoothed state and of `initial_state_cov` wrong. `KalmanFilter.filter`, whose results had the wrong `initial_state_cov` too, gets no note here because statsmodels#11028, statsmodels#11035 and statsmodels#11036 change its docstring and code next to `complex_step`; the release note covers it.
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 25, 2026
The `versionchanged` note of the `complex_step` argument also says that the results no longer initialize the state again without complex step, which made the derivatives of the first period of the smoothed state and of `initial_state_cov` wrong. `KalmanFilter.filter`, whose results had the wrong `initial_state_cov` too, gets no note here because statsmodels#11028, statsmodels#11035 and statsmodels#11036 change its docstring and code next to `complex_step`; the release note covers it.
bashtage
force-pushed
the
wip-ss-filter-timing-tolerance
branch
from
November 25, 2026 12:12
4e4792c to
87fb2c6
Compare
Member
Author
|
Merge order. These open PRs build on this one (their branches contain its commits), so please merge this PR first: Once this PR is merged, their diffs shrink to their own changes. Each of them also says "Stacked on #..." at the top of its description. Merge-order note generated with Claude Code (updated 2026-11-25). |
4 of 5 tasks
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 27, 2026
The `versionchanged` note of the `complex_step` argument also says that the results no longer initialize the state again without complex step, which made the derivatives of the first period of the smoothed state and of `initial_state_cov` wrong. `KalmanFilter.filter`, whose results had the wrong `initial_state_cov` too, gets no note here because statsmodels#11028, statsmodels#11035 and statsmodels#11036 change its docstring and code next to `complex_step`; the release note covers it.
`KalmanFilter._filter` passed its options positionally to `_initialize_filter`, whose signature has `tolerance` before `filter_timing`, so the two were swapped. `filter(filter_timing=1)` ran with the model's timing and a convergence tolerance of 1 (llf -76.37 instead of -76.27 for an AR(1) with an approximate diffuse initialization), and `filter(tolerance=1e-4)` ran with the model's tolerance (1e-19) and the tolerance as the timing. `loglike`, `loglikeobs` and `smooth` pass these options through `_filter`, so they were affected in the same way. Changes: `_filter` passes every option to `_initialize_filter` by keyword, and `KalmanFilter.filter` has a `versionchanged` note. Not changed: options set on the model, and the other options given to `filter` (they were already passed in the right positions). Tests: `filter_timing=1` and `tolerance=1e-4` given to `filter`, `smooth`, `loglike` and `loglikeobs` give the output of the same option set on the model (results options, period of convergence, llf, filtered and smoothed states, loglikelihood values), and the options change the loglikelihood (and a looser tolerance converges earlier), so that the comparison is not vacuous. A second test checks that each of the seven options given to `filter` reaches the compiled filter and matches the option set on the model. 10 of the 15 new tests fail on main; the other five guard the options that were already passed correctly.
bashtage
force-pushed
the
wip-ss-filter-timing-tolerance
branch
from
November 28, 2026 21:36
87fb2c6 to
25729ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KalmanFilter._filterpassed its options positionally to_initialize_filter, whose signature hastolerancebeforefilter_timing, so the two were swapped.filter(filter_timing=1)ranwith the model's timing and a convergence tolerance of 1 (llf -76.37
instead of -76.27 for an AR(1) with an approximate diffuse
initialization), and
filter(tolerance=1e-4)ran with the model'stolerance (1e-19) and the tolerance as the timing.
loglike,loglikeobsandsmoothpass these options through_filter, so theywere affected in the same way.
Changes:
_filterpasses every option to_initialize_filterbykeyword, and
KalmanFilter.filterhas aversionchangednote.Not changed: options set on the model, and the other options given to
filter(they were already passed in the right positions).Tests:
filter_timing=1andtolerance=1e-4given tofilter,smooth,loglikeandloglikeobsgive the output of the same option set on themodel (results options, period of convergence, llf, filtered and smoothed
states, loglikelihood values), and the options change the loglikelihood
(and a looser tolerance converges earlier), so that the comparison is
not vacuous. A second test checks that each of the seven options given
to
filterreaches the compiled filter and matches the option set onthe model. 10 of the 15 new tests fail on main; the other five guard the
options that were already passed correctly.
NumPy's guide.
AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the
<...>placeholders in the second option with the tool name(s) and how the tool's output was
used.
Tool(s): Claude Code (Claude Opus 5.5).
Used for: finding the bug in a contract audit, writing the fix and its tests, and checking them (tests failing on main, mutation check).
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.
🤖 Generated with Claude Code