pulkroben {gofcat} | R Documentation |
Pulkstenis-Robinson Test for Categorical Response Models
Description
This provides a post estimation goodness-of-fit test for the ordinal response models. Supported models include the proportional odds, adjacent-category, and constrained continuation-ratio models.
Usage
pulkroben(model, test = c("chisq", "deviance"), tables = FALSE)
Arguments
model |
a model object or data.frame of observed and estimated
values. The following class of objects can be directly passed to the
|
test |
chooses between the chi-squared and the deviance test statistic. |
tables |
Default to FALSE. When TRUE, both the observed and the expected frequency tables are printed alongside test results. |
Details
The Pulkstenis-Robinson test groups the observations using the covariate patterns obtained from the categorical covariates. Each covariate pattern is subsequently split in two based on the median ordinal scores. The test statistic (chi-sq or deviance) is obtaned using the tabulated observed and estimated frequencies. Assuming c is the number of covariate patterns, r the number of response categories and k the number of categorical variables in the model, the test statistic approximates the chi-sq distribution with (2c - 1)(r - 1) - k - 1 degrees of freedom (Pulkstenis and Robinson (2004)). As recommended in Fagerland and Hosmer (2016, 2017), this test should be compared with the Hosmer-Lemeshow and the Lipsitz tests.
Value
stat |
realized value of the chi-square or deviance statistic. |
df |
the degrees of freedom. |
p.value |
the p-value of the test statistic. |
observed |
a table of the observed frequencies. |
expected |
a table of the estimated frequencies. |
rho |
percentage of estimated frequencies greater than one. |
test |
a character vector of the type of test statistic used. |
tables |
a TRUE or FALSE logical vector. |
References
Pulkstenis, E. and Robinson, T. J. (2004). Goodness-of-fit tests for ordinal response regression models. Statistics in Medicine 23, 999-1014.
Fagerland, M. W. and Hosmer, D. W. (2016). Tests for goodness of fit in ordinal logistic regression models. Journal of Statistical Computation and Simulation, 86, 3398-3418.
Fagerland, M. W. and Hosmer, D. W. (2017). How to test for goodness of fit in ordinal logistic regression models. Stata Journal, 17, 668-686.
See Also
hosmerlem
, lipsitz
, brant.test
,
LR.test
Examples
require(VGAM)
set.seed(1)
n <- 200
y <- ordered(rbinom(n, 2, 0.5))
x1 <- factor(rbinom(n, 1, 0.7))
x2 <- runif(n)
## proportional odds model
vg <- vglm(y ~ x1 + x2, model = TRUE,
family = cumulative(link = "logitlink", parallel = TRUE))
pulkroben(vg, tables = TRUE)
## adjacent category model
ac <- update(vg, family = acat(parallel = TRUE))
pulkroben(ac, tables = TRUE)
## continuation ratio model
cr <- update(vg, family = cratio(parallel = TRUE))
pulkroben(cr, tables = TRUE)