I think the other answer gives you a work-around for getting CI for glmmTMB objects using the se.fit
argument. But the issue of having specific versions of functions for different object types (defined by the class of the object) is something that caused me some grief in the past so it may be worth expanding on here.
Without getting in too much detail, functions in R that are common across many object types have generic versions. If you got to the documentation for ?predict
, for example, you will see the help page for the generic version of the function. There you will see a few general statements about how the function normally works but little to no explanation of specific arguments since the arguments available depend on the type of object you are working with. The description from the help page for generic predict()
:
predict is a generic function for predictions from the results of
various model fitting functions. The function invokes particular
methods which depend on the class of the first argument.
Specific model fitting functions can have specific versions ofpredict()
that work with the resulting model object. For example, there is a specific predict()
for models fit with lm()
. Objects returned from lm()
are of class lm. You can see the documentation for the version of the function for lm objects at ?predict.lm
. It is this function that contains an intervals
argument for calculating confidence and prediction intervals. While many of us start with lm objects and so learn intervals
, it turns out many (most?) other predict()
functions do not have this option.
The key for getting to the help page for the specific predict()
function you are using is to know the class of the object returned by the model fitting function you are using. For example, models fit with glmmTMB()
are of class glmmTMB so you can go to ?predict.glmmTMB
. Models fit with lme4::lmer()
are of class merMod so you can go to ?predict.merMod.
If you don't know the class a model-fitting function returns, it looks like you can often find the info in the documentation under the Value section. This is true for lm()
and lmer()
, at least.
Finally, if you need to know if a certain class of object has a specific version of a generic function associated with it, you can look at the methods available for that class with the methods()
function. Example for lm:
methods(class = "lm")
[1] add1 alias anova case.names coerce
[6] confint cooks.distance deviance dfbeta dfbetas
[11] drop1 dummy.coef effects extractAIC family
[16] formula hatvalues influence initialize kappa
[21] labels logLik model.frame model.matrix nobs
[26] plot predict print proj qqnorm
[31] qr residuals rstandard rstudent show
[36] simulate slotsFromS3 summary variable.names vcov