Skip to content

ENH: Add Brant test for proportional odds assumption in OrderedModel (closes #8442) - #10248

Open
Shikhar-Kesharwani wants to merge 2 commits into
statsmodels:mainfrom
Shikhar-Kesharwani:enh/diagnostic-tests-brant-beta-dunn
Open

Shikhar-Kesharwani wants to merge 2 commits into
statsmodels:mainfrom
Shikhar-Kesharwani:enh/diagnostic-tests-brant-beta-dunn

Conversation

@Shikhar-Kesharwani

@Shikhar-Kesharwani Shikhar-Kesharwani commented Sep 13, 2026 •

Copy link
Copy Markdown

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

Please complete one of the following:

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude.
    Used for: drafting an implementation, writing tests, and editing docstrings.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.

Summary & Motivation

This PR implements the Brant test for evaluating the parallel regression / proportional odds assumption in ordinal response models (OrderedModel), resolving issue #8442.

Key features:

  • Implements brant_test() in statsmodels.discrete._diagnostics_ordered (re-exported in statsmodels.discrete.diagnostic).
  • Adds the .brant_test() post-estimation method directly on OrderedResults in statsmodels.miscmodels.ordinal_model.
  • Evaluates the parallel regression assumption in ordered logit and probit models by fitting $J-1$ binary response models and testing parameter constraints via a Wald $\chi^2$ omnibus test alongside variable-by-variable tests.
  • Returns a structured BrantResults container with .wald_chi2, .df, .pvalues, .table, and formatted .summary().
  • Numerically benchmarked against R's brant package on the UCLA ordinal logistic regression benchmark dataset (Omnibus: $\chi^2 = 4.3443, p = 0.2266$; variable tests: pared $p=0.7160$, public $p=0.0635$, gpa $p=0.6722$).
  • Comprehensive unit test suite: TestBrantTest with 6 passing tests in statsmodels/miscmodels/tests/test_ordinal_model.py.

@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Thanks, the AI Disclosure section looks complete.

Comment on lines +21 to +24
from statsmodels.discrete._diagnostics_ordered import (
BrantResults,
brant_test,
)
@Aniketsy

Copy link
Copy Markdown
Contributor

@Shikhar-Kesharwani why you covered three issues, in single PR, are these related to each other, if not i will suggest to split this and keep 1 issue for single PR, it will be easy to review :)

thanks for the work.

@Shikhar-Kesharwani
Shikhar-Kesharwani force-pushed the enh/diagnostic-tests-brant-beta-dunn branch from 5659791 to 99cfe5c Compare September 13, 2026 14:20
@Shikhar-Kesharwani Shikhar-Kesharwani changed the title ENH: Add Brant test, standardized beta coefficients, and Dunn post-hoc test ENH: Add Brant test for proportional odds assumption in OrderedModel (closes #8442) Sep 13, 2026
@Shikhar-Kesharwani

Copy link
Copy Markdown
Author

Thanks for the helpful suggestion @Aniketsy! That makes total sense and makes each feature much cleaner and easier to review independently.

I have split them into three dedicated, standalone PRs:

Each PR now has its own isolated diff, targeted unit tests, benchmark validations, and AI disclosure checklist.

@Shikhar-Kesharwani

Copy link
Copy Markdown
Author

Hi @Aniketsy, thank you for the feedback!

You are completely right. I have already separated the other two features into independent, dedicated pull requests:

This pull request (#10248) is now strictly scoped to the Brant test for the proportional odds assumption in OrderedModel (closes #8442).

I am also addressing the import cycle flagged by the static analysis check. Thanks again for your guidance!

exog_names = [f"x{i+1}" for i in range(K)]

# Fit J - 1 binary logit models
from statsmodels.discrete.discrete_model import Logit
…loses statsmodels#8442)

- Add brant_test() function and BrantResults class in statsmodels.discrete._diagnostics_ordered
- Re-export brant_test and BrantResults in statsmodels.discrete.diagnostic
- Add .brant_test() method to OrderedResults in statsmodels.miscmodels.ordinal_model
- Supports logit and probit links, omnibus Wald test, and variable-by-variable tests
- Validated against R's brant package on UCLA benchmark dataset
- Unit tests added in statsmodels/miscmodels/tests/test_ordinal_model.py

Signed-off-by: Shikhar Kesharwani <[email protected]>
@bashtage
bashtage force-pushed the enh/diagnostic-tests-brant-beta-dunn branch from a07d2a9 to ddb4fcf Compare October 27, 2026 19:53
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.

A Class for Brant test for OrderedModel (using Python)

3 participants