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.

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 pulkroben function: vglm(), serp(), polr(), and clm(). Other class of objects require providing a data.frame of observed and predicted values.

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.

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.

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.

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.

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)
#> 
#> Pulkstenis-Robinson Chi-squared Test:
#> 
#>                     chi-sq   df   pr(>chi)  
#> ordinal(pulkroben)  10.021    4    0.04007 *
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> H0: No lack of fit dictated
#> 
#> rho: 100% 
#> 
#> 
#> Observed Freqs:
#> 
#>  cov.pat total  0  1  2
#>       p1    75 21 37 17
#>       q1    74 14 38 22
#>       p2    26  1 18  7
#>       q2    25  5 17  3
#> 
#> Expected Freqs:
#> 
#>  cov.pat      0      1      2
#>       p1 16.791 41.414 16.795
#>       q1 14.625 40.688 18.687
#>       p2  5.284 14.318  6.399
#>       q2  4.401 13.594  7.005
#> 
#>  p <= median OS; q > median OS
#> 

## adjacent category model
ac <- update(vg, family = acat(parallel = TRUE))
pulkroben(ac, tables = TRUE)
#> 
#> Pulkstenis-Robinson Chi-squared Test:
#> 
#>                     chi-sq   df   pr(>chi)  
#> ordinal(pulkroben)  9.9975    4    0.04047 *
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> H0: No lack of fit dictated
#> 
#> rho: 100% 
#> 
#> 
#> Observed Freqs:
#> 
#>  cov.pat total  0  1  2
#>       p1    75 21 37 17
#>       q1    74 14 38 22
#>       p2    26  1 18  7
#>       q2    25  5 17  3
#> 
#> Expected Freqs:
#> 
#>  cov.pat      0      1      2
#>       p1 16.804 41.381 16.815
#>       q1 14.655 40.699 18.645
#>       p2  5.209 14.306  6.485
#>       q2  4.331 13.614  7.055
#> 
#>  p <= median OS; q > median OS
#> 

## continuation ratio model
cr <- update(vg, family = cratio(parallel = TRUE))
pulkroben(cr, tables = TRUE)
#> 
#> Pulkstenis-Robinson Chi-squared Test:
#> 
#>                     chi-sq   df   pr(>chi)  
#> ordinal(pulkroben)  10.145    4    0.03806 *
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> H0: No lack of fit dictated
#> 
#> rho: 100% 
#> 
#> 
#> Observed Freqs:
#> 
#>  cov.pat total  0  1  2
#>       p1    75 21 37 17
#>       q1    74 14 38 22
#>       p2    26  1 18  7
#>       q2    25  5 17  3
#> 
#> Expected Freqs:
#> 
#>  cov.pat      0      1      2
#>       p1 16.390 41.612 16.998
#>       q1 14.480 40.506 19.014
#>       p2  5.481 14.372  6.148
#>       q2  4.650 13.571  6.779
#> 
#>  p <= median OS; q > median OS
#>