Repository navigation
BUG: include finite exact-diffuse innovations in concentrated loglike (closes #10741) - #10742
Merged
bashtage merged 1 commit intoNov 15, 2026
Merged
Conversation
Retain finite innovations inside diffuse periods in the concentrated joint log-likelihood calculation and count, handling burn consistently. Closes statsmodels#10741
Member
|
Thanks. |
This was referenced Nov 15, 2026
bashtage
added a commit
that referenced
this pull request
Nov 16, 2026
Move the bullet of #10742 to the end of the "Time series analysis" bug fix list, add its :pr: role, and say what users see: loglike now equals loglikeobs().sum(), llf and the fixed_scale value, also for conserve_memory settings; values and fitted parameters change when the diffuse periods contain finite innovations (several observed series with one diffuse state, a diffuse state observed only later), and single series models without such innovations (local level, local linear trend, SARIMAX with concentrate_scale) are unchanged. The bullet stays under Bug Fixes, as the neighbouring merged #10713 bullet. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
that referenced
this pull request
Nov 16, 2026
Follow-up to #10742. Drop atol from the new tests (values are of order 1 to 5, rtol=1e-12 holds on Python 3.13 and 3.10). Add a test against R KFAS 1.6.0 for the issue model (KFAS logLik less 0.5 * log(2 * pi) of the diffuse innovation, which KFAS omits), for every conserve_memory setting, and tests through MLEModel: a bivariate local level with finite diffuse innovations (complete and with missing data, loglikelihood_burn 0, 1, 3, compared with the non-concentrated model at the estimated scale, plus complex step against finite difference scores) and SARIMAX(0, 1, 1) with concentrate_scale and exact diffuse initialization (default and explicit loglikelihood_burn). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
that referenced
this pull request
Nov 16, 2026
DOC: Follow up #10742 on the concentrated diffuse loglike, with tests
4 of 5 tasks
bashtage
added a commit
that referenced
this pull request
Nov 16, 2026
The release note of #10744 named only cov_type="cluster". Every covariance type that sets df_resid_inference changes: "cluster" (also two-way clustering), "hac-panel" and "hac-groupsum" for all models and "cluster-crv3" and "cluster-jk" for linear models, unless df_correction=False. With use_t=False nothing changes. Checked with seeded OLS, GLM, Logit and Poisson fits with 10 clusters on main before and after #10744. The entry stays in Bug Fixes with the neighbouring #10742, #10737 and #10736. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
5 of 6 tasks
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.
Description
When combining concentrated scale (
filter_concentrated = True) with exact diffuse initialization,KalmanFilter.loglike()omits finite innovations that occur during diffuse periods from the quadratic penalty and subtracts them from the finite innovation count.As reported in #10741, this leads to an internal inconsistency between
loglike()and other likelihood methods: on a 2-observation, 1-state model,model.loglike()evaluates to-4.906342, whereasmodel.loglikeobs().sum(),result.llf, andmodel.fixed_scale(...)all evaluate to-4.004213(~0.902 log-likelihood units discrepancy).This PR:
KalmanFilter.loglike().loglikelihood_burncorrectly when burn ends within the diffuse initialization period.test_concentrated.pycovering closed-form solutions, missingness patterns, and memory conservation.docs/source/release/version0.15.1.rst.AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tool(s): GitHub Copilot.
Used for: code completion and drafting test assertions.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.