Repository navigation
DOC: Follow up #10781 on the use_t docstring of GEE - #10790
Merged
Merged
Conversation
…se_t The use_t docstring said that Li and Redden (2015) found the number of groups minus the number of parameters to work well with the bias-corrected covariances. Their abstract says that with a t distribution the Kauermann-Carroll correction keeps the size of the test close to its nominal level in trials with few clusters; the degrees of freedom of the paper were not checked. Say what the paper reports and what the subtraction does. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
marked this pull request as ready for review
November 18, 2026 18:33
5 of 6 tasks
bashtage
added a commit
that referenced
this pull request
Nov 19, 2026
BUG: Follow up #10790 on GEE marginal effects and small-sample covariances
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.
Follow up to #10781 (GEE
use_tandcov_type="kauermann_carroll", merged at 18:14 UTC on 18 November). The review of its last head left one point that no change of the PR covered: a claim in theuse_tdocstring that I could not confirm. Documentation only.test_gee.pypasses, see the checks)NumPy's guide.
Change (one
DOC:commit)use_tentry ofGEE.fitsaid that the number of parameters is subtracted, not 1 as forOLSwithcov_type="cluster"or Stata'svce(cluster), "because Li and Redden (2015) found these degrees of freedom to work well with the bias-corrected covariances when there are few groups". The abstract of Li and Redden (Stat Med 34(2):281-296) says that the GEE Wald z test should be avoided with few clusters even with bias-corrected covariances and that, with a t distribution approximation, the Kauermann-Carroll correction keeps the size of the test close to its nominal level; I did not find the degrees of freedom of the paper in the sources I could read (the abstract and papers that cite it), so the sentence is replaced by what the subtraction does (fewer degrees of freedom and heavier tails the more parameters the model has) and what the paper reports.ValueErrorfor a model with no more groups than parameters, the references and the other tests are unchanged.Checks
GEE.fit.__doc__renders with the new text (checked by printing it).statsmodels/genmod/tests/test_gee.py: 124 passed (Python 3.13, pandas 3.1.0) and 121 passed, 3 skipped on the minimum versions (Python 3.10, NumPy 1.23.5, SciPy 1.8.1, pandas 1.5.3; the tree under test was the one imported).ruff check .andgit diff --checkpass. Sphinx was not run.Not changed (from the review of #10781)
GEE.get_margeff()ignoresuse_t;cov_typeis case-sensitive ("Kauermann_Carroll"raises anUnboundLocalError)..realofsqrtmdrops an imaginary part for a numerically singularI - H(a one-observation cluster with its own dummy), after which the solve raises a bareLinAlgError; not new in kind (the same forbias_reduced).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 Sonnet 5.5).
Used for: reviewing ENH: Add use_t and Kauermann-Carroll covariance to GEE #10781, and writing and checking the follow-up change.
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