Skip to contents

ranef() returns conditional random-effect estimates for one fitted random effect block, or all fitted random-effect blocks when dpar = NULL.

Usage

ranef(object, ...)

# S3 method for class 'drmTMB'
ranef(object, dpar = NULL, ...)

Arguments

object

A drmTMB fit.

...

Reserved for future extractor options.

dpar

Optional random-effect block name, such as "mu", "sigma", "phylo_mu", or "spatial_mu".

Value

A named list of random-effect blocks when dpar = NULL, otherwise one random-effect block.

Details

The returned blocks use the internal drmTMB structure: values are on the model scale, latent are the corresponding standard-normal latent effects, and terms split model-scale values by random-effect term.

Examples

set.seed(20260525)
id <- factor(rep(letters[1:8], each = 8))
x <- rep(seq(-1, 1, length.out = 8), times = 8)
u <- rnorm(nlevels(id), sd = 0.9)
dat <- data.frame(
  y = 0.2 + 0.7 * x + u[id] + rnorm(length(x), sd = 0.3),
  x = x,
  id = id
)
fit <- drmTMB(bf(y ~ x + (1 | id), sigma ~ 1), data = dat)
names(ranef(fit))
#> [1] "mu"
head(ranef(fit, "mu")$terms[["(1 | id)"]])
#>          a          b          c          d          e          f 
#>  1.3729442  0.6790215 -1.9030966  0.7870208 -1.0692608  0.7551509