Skip to content

DOC: Follow up #10781 on the use_t docstring of GEE - #10790

Merged
bashtage merged 1 commit into
statsmodels:mainfrom
bashtage:wip-gee-use-t-followup
Nov 18, 2026
Merged

bashtage merged 1 commit into
statsmodels:mainfrom
bashtage:wip-gee-use-t-followup

Conversation

@bashtage

Copy link
Copy Markdown
Member

Follow up to #10781 (GEE use_t and cov_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 the use_t docstring that I could not confirm. Documentation only.

  • tests added / passed. (no code change: test_gee.py passes, see the checks)
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

Change (one DOC: commit)

  • The use_t entry of GEE.fit said that the number of parameters is subtracted, not 1 as for OLS with cov_type="cluster" or Stata's vce(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.
  • The code, the ValueError for 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 . and git diff --check pass. Sphinx was not run.

Not changed (from the review of #10781)

  • Separate issues, as in the review: GEE.get_margeff() ignores use_t; cov_type is case-sensitive ("Kauermann_Carroll" raises an UnboundLocalError).
  • .real of sqrtm drops an imaginary part for a numerically singular I - H (a one-observation cluster with its own dummy), after which the solve raises a bare LinAlgError; not new in kind (the same for bias_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.

  • 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 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

…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
bashtage marked this pull request as ready for review November 18, 2026 18:33
@bashtage
bashtage merged commit 506f54e into statsmodels:main Nov 18, 2026
11 of 12 checks passed
bashtage added a commit that referenced this pull request Nov 19, 2026
BUG: Follow up #10790 on GEE marginal effects and small-sample covariances
@bashtage
bashtage deleted the wip-gee-use-t-followup branch November 20, 2026 10:56
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