Description Usage Arguments Details Value Author(s) References See Also Examples
Performs the Lipsitz goodness of fit test for ordinal logistic regression models.
1 | lipsitz.test(model, g = 10)
|
model |
an ordinal logistic regression model. Must be an object of class |
g |
number of quantiles of risk, defaults to 10. |
The Lipsitz test is a goodness of fit test for ordinal response logistic regression models. It involves binning the observed data into equally sized g
groups based on an ordinal response score. This score is computed by summing the predicted probabilities of each subject for each outcome level multiplied by equally spaced integer weights. The user can specify the number of groups by assigning an integer value to g
, which is 10 by default.
Given this partitioning of the data, dummy variables, I
, are derived such that, for each group, I = 1
if the subject is in region g
and I = 0
if not. The model is then re-fit with these dummy variables. If the model has good fit, then the coefficients for all these dummy variables simultaneously = 0. Lipsitz et al (1996) suggest that likelihood ratio, Wald or score tests can be used; lipsitz.test
just uses the likelihood ratio test with g-1
degrees of freedom.
Note that the outcome variable MUST be converted to a factor before running the model. Using as.factor()
within the model function will cause an error because of the way in which lipsitz.test
uses the update()
function to re-fit the model.
It is recommended (Fagerland and Hosmer, 2016) that the Lipsitz test be run alongside the ordinal Hosmer-Lemeshow test (logitgof
) and the Pulkstenis-Robinson tests (pulkrob.chisq
and pulkrob.deviance
).
A list of class htest
containing:
statistic |
the value of the likelihood ratio 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. |
newmoddata |
a data frame containing the data used in fitting the updated model (the original data plus the dummy variables). |
predictedprobs |
a data frame of predicted probabilities from the original model. |
Matthew Alexander Jay
Fagerland MW, Hosmer DW. A goodness-of-fit test for the proportional odds regression model. Statistics in Medicine 2013;32:2235-2249.
Fagerland MW, Hosmer DW. Tests for goodness of fit in ordinal logistic regression models. Journal of Statistical Computation and Simulation 2016. DOI: 10.1080/00949655.2016.1156682.
Lipsitz SR, Fitzmaurice GM, Molenberghs G. Goodness-of-Fit Tests for Ordinal Response Regression Models. Journal of the Royal Statistical Society 1996;45(2):175-190.
1 2 3 4 5 6 7 8 9 10 |
Loading required package: reshape
Loading required package: MASS
Lipsitz goodness of fit test for ordinal response models
data: formula: gear ~ mpg + cyl
LR statistic = 13.148, df = 9, p-value = 0.156
Warning messages:
1: In lipsitz.test(mod1) :
g >= n/5c. Running this test when g >= n/5c is not recommended.
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
Lipsitz goodness of fit test for ordinal response models
data: formula: gear ~ mpg
LR statistic = 8.5871, df = 9, p-value = 0.4762
Warning messages:
1: In lipsitz.test(mod2) :
g >= n/5c. Running this test when g >= n/5c is not recommended.
2: (1) Hessian is numerically singular: parameters are not uniquely determined
In addition: Absolute convergence criterion was met, but relative criterion was not met
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.