Predict from an ordered panel model
Arguments
- object
a
"panordered"fit (frompanglm()with an ordered family)- newdata
optional data frame; defaults to the fitted data
- type
"prob"for the matrix of category probabilities (population-averaged over the random intercept formodel = "random"),"class"for the most likely category, or"link"forx'beta- ...
unused
Value
a matrix with one column per category ("prob"), a factor
("class") or a numeric vector ("link")
See also
Other panglm methods:
coefplot(),
confint.panglm(),
effectcurve(),
fitted.panglm(),
fixef(),
glance.panglm(),
logLik.panglm(),
model.matrix.panglm(),
partialeffects.panordered(),
plot.panglm(),
plot.panglm_ape(),
plot.panglm_effectcurve(),
predict.panglm(),
residuals.panglm(),
summary.panglm(),
tidy.panglm(),
vcov.panglm()
Examples
data(copd)
copd$lf <- cut(copd$fev1, 3, labels = c("low", "mid", "high"))
fit <- panglm(lf ~ crp + age, data = copd, index = c("id", "visit"),
model = "pooling", family = "ologit")
head(predict(fit, type = "prob"))
#> low mid high
#> [1,] 0.3622632 0.5380532 0.09968362
#> [2,] 0.2083513 0.5987692 0.19287953
#> [3,] 0.3091034 0.5676442 0.12325240
#> [4,] 0.3381230 0.5522571 0.10961992
#> [5,] 0.2869118 0.5779029 0.13518524
#> [6,] 0.2197194 0.5977054 0.18257514
predict(fit, newdata = copd[1:3, ], type = "class")
#> [1] mid mid mid
#> Levels: low mid high