predict.glmmTMB  R Documentation 
prediction
## S3 method for class 'glmmTMB'
predict(
object,
newdata = NULL,
newparams = NULL,
se.fit = FALSE,
cov.fit = FALSE,
re.form = NULL,
allow.new.levels = FALSE,
type = c("link", "response", "conditional", "zprob", "zlink", "disp"),
zitype = NULL,
na.action = na.pass,
fast = NULL,
debug = FALSE,
...
)
object 
a 
newdata 
new data for prediction 
newparams 
new parameters for prediction 
se.fit 
return the standard errors of the predicted values? 
cov.fit 
return the covariance matrix of the predicted values? 
re.form 

allow.new.levels 
allow previously unobserved levels in randomeffects variables? see details. 
type 
Denoting

zitype 
deprecated: formerly used to specify type of zeroinflation probability. Now synonymous with 
na.action 
how to handle missing values in 
fast 
predict without expanding memory (default is TRUE if 
debug 
(logical) return the 
... 
unused  for method compatibility 
To compute populationlevel predictions for a given grouping variable (i.e., setting all random effects for that grouping variable to zero), set the grouping variable values to NA
. Finerscale control of conditioning (e.g. allowing variation among groups in intercepts but not slopes when predicting from a randomslopes model) is not currently possible.
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).
Prediction using "datadependent bases" (variables whose scaling or transformation depends on the original data, e.g. poly
, ns
, or poly
) should work properly; however, users are advised to check results extracarefully when using such variables. Models with different versions of the same datadependent basis type in different components (e.g. formula= y ~ poly(x,3), dispformula= ~poly(x,2)
) will probably not produce correct predictions.
data(sleepstudy,package="lme4")
g0 < glmmTMB(Reaction~Days+(DaysSubject),sleepstudy)
predict(g0, sleepstudy)
## Predict new Subject
nd < sleepstudy[1,]
nd$Subject < "new"
predict(g0, newdata=nd, allow.new.levels=TRUE)
## populationlevel prediction
nd_pop < data.frame(Days=unique(sleepstudy$Days),
Subject=NA)
predict(g0, newdata=nd_pop)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.