# predict method of hospital admission
require(VGAMdata)
data(vtinpat)
# to save time, take a sample of this data
set.seed(32149)
idx <- sample(1:dim(vtinpat)[1], 5000, replace=F)
vtinpat <- vtinpat[idx,]
vtinpat$hos.num <- as.numeric(vtinpat$hospital)
vtinpat$age <- as.numeric(vtinpat$age.group)
vtinpat.mlogit <- mlogit.data(vtinpat, choice = "admit", shape="wide")
vt.mod <- mlogit(admit ~ 0 | age + sex, data = vtinpat.mlogit)
summary(vt.mod)
# compute cluster bootstrapped p-values (takes a while)
clust.p <- cluster.bs.mlogit(vt.mod, dat=vtinpat, cluster = ~ hos.num, report=TRUE)Run the code above in your browser using DataLab