pulkrob: Pulkstenis-Robinson goodness of fit tests for ordinal...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Performs the Pulkstenis-Robinson goodness of fit chi-squared and deviance tests for ordinal logistic regression models.

Usage

1
2
pulkrob.chisq(model, catvars)
pulkrob.deviance(model, catvars)

Arguments

model

an ordinal response model. Must be an object of class polr or clm.

catvars

a character vector containing the names of the categorical covariates.

Details

The Pulkstenis-Robinson tests are goodness of fit tests for ordinal logistic regression models. They are capable of accommodating models with continuous as well as categorical predictors. The data are partitioned according to observed covariate patterns using the categorical covariates only. Any unobserved covariate patterns are discarded. Only categorical predictors are used to avoid partitioning among an unacceptably high number of covariate patterns. Each subject is assigned an ordinal response score by summing the predicted probabilities of each subject for each outcome level multiplied by equally spaced integer weights. The covariate patterns are then split into two at the median score within each.

Based on this partitioning, observed and expected frequencies are calculated and the test statistic computed. This statistic is distributed by the chi-squared distribution with (2I - 1)(J - 1) - k - 1 degress of freedom, where I is the number of covariate patterns, J is the number of of response categories and k is the number of categorical variables in the model.

It is recommended (Fagerland and Hosmer, 2016) that the Pulkstenis-Robinson tests be run alongside the Hosmer-Lemeshow test (logitgof) and the Lipsitz test (lipsitz.test).

Value

A list of class htest containing:

statistic

the chi-squared or deviance statistic.

parameter

degrees of freedom used.

p.value

the p-value.

method

a character string indicating the name of the test.

data.name

a character string indicating the model formula used.

observed

a cast generated data frame of observed frequencies.

expected

a cast generated data frame of expected frequencies.

stddiffs

a table of the standardised differences. See Hosmer, Lemeshow and Sturdivant (2013), p 162.

Author(s)

Matthew Alexander Jay, with code from epiR::epi.cp() by Mark Stevenson.

References

See Also

logitgof, lipsitz.test.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(mtcars)

# using polr
mod1 <- polr(as.factor(gear) ~ mpg + cyl + vs, data = mtcars)
pulkrob.chisq(mod1, c("vs"))
pulkrob.deviance(mod1, c("vs"))

# using clm - ensure outcome variable is a factor before fitting the model
library(ordinal)
mtcars$gear <- as.factor(mtcars$gear)
mod2 <- clm(gear ~ mpg + cyl + vs, data = mtcars)
pulkrob.chisq(mod2, c("vs"))
pulkrob.deviance(mod2, c("vs"))

matthewjay15/generalhoslem documentation built on June 6, 2019, 11:24 a.m.