Skip to content

TST: Check news with a dataset and longer exog against closed forms - #11057

Draft
bashtage wants to merge 1 commit into
statsmodels:mainfrom
bashtage:wip-mlemodel-news-univariate-exog
Draft

bashtage wants to merge 1 commit into
statsmodels:mainfrom
bashtage:wip-mlemodel-news-univariate-exog

Conversation

@bashtage

@bashtage bashtage commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Test-only follow-up to #11273, which fixed MLEResults.news for a
univariate model whose comparison dataset is shorter than exog. This PR
first carried the same fix; it is now rebased onto main with #11273's fix
and keeps only its test, which covers cases #11273's test does not.

Tests

  • test_news_dataset_with_longer_exog, for a regression with AR(1) errors
    and for a VAR(1) with exog: the total impact of observing y_10 on the
    forecast of y_11 equals the closed form (phi (u_10 - phi u_9) and
    A (y_10 - A y_9 - B x_10)), the columns are the endog names, and the news
    equals the news from results for the dataset extended by hand with
    missing values.
  • It passes on main; with BUG: Accept a dataset in news for a univariate model with longer exog #11273's one-line fix reverted, the univariate
    case raises the original TypeError.
  • No release note: the change is test-only.

#11055, #11058, #11060 and the #11063 stack also append tests to
test_mlemodel.py: whichever merges later keeps every appended block.

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    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.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude Code (Claude Opus 5.5).
    Used for: writing the test and checking it (closed forms, and a mutation check against the fix in BUG: Accept a dataset in news for a univariate model with longer exog #11273).
    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

@bashtage
bashtage force-pushed the wip-mlemodel-news-univariate-exog branch 6 times, most recently from 51b78d2 to a6eac97 Compare November 27, 2026 23:39
@bashtage bashtage changed the title BUG: Fix news with a dataset and longer exog for univariate models TST: Check news with a dataset and longer exog against closed forms Nov 27, 2026
statsmodels#11273 made MLEResults.news accept a comparison dataset shorter than
exog for a univariate model. Add a test for the cases its test does not
cover: a VAR(1) with exog besides the regression with AR(1) errors, the
total impact compared with its closed form, and the news compared with
the news from results for the dataset extended by hand.

Tests
- For a regression with AR(1) errors and a VAR(1) with exog, the total
  impact of observing y_10 on the forecast of y_11 equals the closed form
  (phi (u_10 - phi u_9) and A (y_10 - A y_9 - B x_10)), the columns are
  the endog names, and the news equals the news from results for the
  dataset extended by hand with missing values.
@bashtage
bashtage force-pushed the wip-mlemodel-news-univariate-exog branch from a6eac97 to 3dbcd9b Compare November 28, 2026 22:06
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.

1 participant