| Title: | Goodness-of-Fit Tests for Ordinal Regression Models |
|---|---|
| Description: | Provides goodness-of-fit tests for ordinal regression models, including the Fagerland-Hosmer ordinal test, reproducing same output as Stata. Supports polr(), vglm(), and binary glm() models. |
| Authors: | Oluwafunto Aladekomo [aut, cre], Evan Kwiatkowski [aut] |
| Maintainer: | Oluwafunto Aladekomo <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-25 09:09:52 UTC |
| Source: | https://github.com/funto-aladekomo/ordinalgof |
Tests the goodness of fit for ordinal regression models, reproducing
results equivalent to Stata's output. Supports models from polr(),
vglm(), and binary glm().
ordinalGOF( model, data, catvars = NULL, g = 10, test = c("hl", "pr.chi2", "pr.dev", "lipsitz"), ties = c("stata", "sorted", "equal"), show_table = FALSE )ordinalGOF( model, data, catvars = NULL, g = 10, test = c("hl", "pr.chi2", "pr.dev", "lipsitz"), ties = c("stata", "sorted", "equal"), show_table = FALSE )
model |
A fitted model object. Supported classes: |
data |
A data frame used to fit the model. |
catvars |
Character vector of categorical variable names. Required only
when |
g |
Integer. Number of quantile groups (default: 10). |
test |
Character. The test to perform. One of |
ties |
Character. Tie-breaking method for grouping. One of
|
show_table |
Logical. If |
An object of class htest containing:
The chi-squared test statistic.
Degrees of freedom.
The p-value.
A character string naming the test used.
## Not run: library(MASS) m <- polr(drinkordinal ~ naltrexone + sex + basepda, data = dat, method = "logistic", Hess = TRUE) ordinalGOF(m, data = dat, g = 10, test = "hl", ties = "stata") ## End(Not run)## Not run: library(MASS) m <- polr(drinkordinal ~ naltrexone + sex + basepda, data = dat, method = "logistic", Hess = TRUE) ordinalGOF(m, data = dat, g = 10, test = "hl", ties = "stata") ## End(Not run)