# NOT RUN {
require(VGAM)
# Binary L-H test
set.seed(1)
gm <- glm(rbinom(100,1,0.5) ~ rnorm(100), family=binomial)
hosmerlem(gm, group = 10, customFreq = NULL, tables = TRUE)
# multinomial L-H test
vg <- vglm(RET ~ DIAB + GH + BP, model = TRUE,
family = multinomial(parallel = TRUE), data = retinopathy)
hosmerlem(vg)
# ordinal L-H test
## proportional odds model
cu <- update(vg, family = cumulative(link = 'logitlink', parallel = TRUE))
hosmerlem(cu, tables=TRUE)
hosmerlem(cu, group = 5, tables=TRUE, customFreq = c(rep(100,5), 113))
## adjacent category model
ac <- update(vg, family = acat(parallel = TRUE))
hosmerlem(ac)
## continuation ratio model
cr <- update(vg, family = cratio(parallel = TRUE))
hosmerlem(cr)
## using data.frame
y <- ordered(retinopathy$RET)
df <- data.frame(y, fitted.values(cr))
hosmerlem(df, tables = TRUE)
# }
Run the code above in your browser using DataLab