Learn R Programming

glmmTMB (version 0.2.0)

predict.glmmTMB: prediction

Description

prediction

Usage

# S3 method for glmmTMB
predict(object, newdata = NULL, se.fit = FALSE, re.form,
  allow.new.levels = FALSE, zitype = c("response", "conditional", "zprob"),
  debug = FALSE, ...)

Arguments

object

a glmmTMB object

newdata

new data for prediction

se.fit

return the standard errors of the predicted values?

re.form

(not yet implemented) specify which random effects to condition on when predicting

allow.new.levels

allow previously unobserved levels in random-effects variables? see details.

zitype

for zero-inflated models, return expected value ("response": (mu*(1-p))), the mean of the conditional distribution ("conditional": mu), or the probability of a structural zero ("zprob")?

debug

(logical) return the TMBStruc object that will be used internally for debugging?

unused - for method compatibility

Details

Prediction of new random effect levels is possible as long as the model specification (fixed effects and parameters) is kept constant. However, to ensure intentional usage, a warning is triggered if allow.new.levels=FALSE (the default).

Examples

Run this code
# NOT RUN {
data(sleepstudy,package="lme4")
g0 <- glmmTMB(Reaction~Days+(Days|Subject),sleepstudy)
predict(g0, sleepstudy)
## Predict new Subject
nd <- sleepstudy[1,]
nd$Subject <- "new"
predict(g0, newdata=nd, allow.new.levels=TRUE)
# }

Run the code above in your browser using DataLab