ranef.glmmTMB {glmmTMB}R Documentation

Extract Random Effects

Description

Extract random effects from a fitted glmmTMB model, both for the conditional model and zero inflation.

Usage

## S3 method for class 'glmmTMB'
ranef(object, condVar = TRUE, ...)

## S3 method for class 'ranef.glmmTMB'
as.data.frame(x, ...)

## S3 method for class 'glmmTMB'
coef(object, condVar = FALSE, ...)

Arguments

object

a glmmTMB model.

condVar

whether to include conditional variances in result.

...

some methods for this generic function require additional arguments (they are unused here and will trigger an error)

x

a ranef.glmmTMB object (i.e., the result of running ranef on a fitted glmmTMB model)

Value

Note

When a model has no zero inflation, the ranef and coef print methods simplify the structure shown, by default. To show the full list structure, use print(ranef(model),simplify=FALSE) or the analogous code for coef. In all cases, the full list structure is used to access the data frames, see example.

See Also

fixef.glmmTMB.

Examples

if (requireNamespace("lme4")) {
   data(sleepstudy, package="lme4")
   model <- glmmTMB(Reaction ~ Days + (1|Subject), sleepstudy)
   rr <- ranef(model)
   print(rr, simplify=FALSE)
   ## extract Subject conditional modes for conditional model
   rr$cond$Subject
   as.data.frame(rr)
}

[Package glmmTMB version 1.1.9 Index]