Repository navigation
TST: Restore Brockwell-Davis Example 6.6.3 GLS test - #11196
Open
fcarvajalbrown wants to merge 1 commit into
Open
fcarvajalbrown wants to merge 1 commit into
fcarvajalbrown wants to merge 1 commit into
Conversation
Fit the seat-belt regression with MA(12) errors without an added constant and compare against the values printed on p. 191 of Brockwell and Davis (2016). The book's estimates come from ITSM's MLE, and gls reaches a slightly higher log-likelihood, so the test checks closeness within tolerance and that gls is at least as good.
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.
Part of #6159, the GLS item "Fix the following test and put it back into the GLS test suite".
The test in #6159 was never going to pass, and not because of gls.
Fix those and gls converges in 53 iterations, close to the book: every MA coefficient within 0.016, the level shift at -321.99 against -328.45 (0.13 of the book's standard error of 49.41), sigma2 at 12559 against 12581. The book's values come from ITSM's MLE, and gls actually does a hair better: log-likelihood -668.565 against -668.595. So the old TODO was right. The test checks those tolerances and asserts gls is at least as good as the book.
Checks: the 46 tests in test_gls.py pass, the new one passes under -W error and fails if include_constant is left at its default, ruff is clean.
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.Used for:
reproducing the failure, comparing log-likelihoods, reading the values off the book page, drafting the test and this description.I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.