Skip to content

ENH: Follow up on #10502, export compare_vuong and complete its docs - #10560

Merged
bashtage merged 3 commits into
statsmodels:mainfrom
bashtage:wip-fu-10502
Oct 25, 2026
Merged

bashtage merged 3 commits into
statsmodels:mainfrom
bashtage:wip-fu-10502

Conversation

@bashtage

Copy link
Copy Markdown
Member
  • closes #xxxx
  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

Follow up to #10502 (compare_vuong). It addresses the points left in the review of that PR.

  • compare_vuong is exported from statsmodels.stats.api, next to compare_cox, compare_j and compare_encompassing. docs/source/stats.rst already lists it.
  • Docstring: versionadded on the function and the result class; correction and alternative use , optional and give the default in the text; VuongTestResult has a one-line docstring like NonNestedTestResult; the Examples block prints the result; the Notes were checked against R. The uncorrected statistic, and the corrected ones for models with the same number of parameters (Poisson against zero-inflated Poisson, Logit against Probit), agree with pscl::vuong. For negative binomial the corrected statistics differ because pscl does not count the dispersion parameter and statsmodels counts every estimated parameter. nonnest2::vuongtest divides by n, so its statistic is larger by sqrt(n / (n - 1)). The Notes also say that Vuong's preliminary test of omega^2 = 0 (needed for nested and overlapping models) is not performed and what happens when omega is exactly 0. The unverified statement that Stata uses the same divisor was removed, and the references are attributed to the sections that contain the formulas.
  • Tests: test_compare_vuong_alternative compares "larger" and "smaller" with scipy.stats.norm for one positive and one negative statistic, and the module-level imports and default_rng follow the conventions.

Not changed: support for OLS and GLM, and a warning for a near-zero omega.

The release note is in the single 0.15.1 draft.

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 Sonnet 5.5).
    Used for: reviewing the merged PR, checking the statistic against R, drafting the docstring and test changes.
    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 and others added 3 commits October 24, 2026 23:14
Add compare_vuong next to compare_cox, compare_j and compare_encompassing. The Sphinx entries in docs/source/stats.rst already exist. Follow up to statsmodelsgh-10502.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Add versionadded, use optional for default markers, document the parameter count convention versus pscl and nonnest2, the missing preliminary variance test and the omega == 0 case, correct the reference attribution, and show the example output. Follow up to statsmodelsgh-10502.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Use default_rng, move imports to module level and test the one-sided alternatives against scipy.stats.norm. Follow up to statsmodelsgh-10502.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@bashtage bashtage mentioned this pull request Oct 24, 2026
4 of 6 tasks
@bashtage
bashtage marked this pull request as ready for review October 25, 2026 09:01
@bashtage
bashtage merged commit b175923 into statsmodels:main Oct 25, 2026
10 of 13 checks passed
@bashtage
bashtage deleted the wip-fu-10502 branch October 29, 2026 17:10
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