Skip to contents

fixef() returns the fixed-effect coefficients for one distributional parameter, or all fixed-effect coefficient blocks when dpar = NULL. It is a mixed-model-friendly alias for coef().

Usage

fixef(object, ...)

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

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

Arguments

object

A drmTMB fit.

...

Reserved for future extractor options.

dpar

Optional distributional parameter name, such as "mu", "sigma", "hu", "rho12", "sd(id)", or "sd_phylo(species)".

Value

A named numeric vector when dpar is supplied, otherwise a named list of coefficient vectors.

Examples

set.seed(20260525)
dat <- data.frame(
  y = 0.2 + 0.6 * seq(-1, 1, length.out = 24) + rnorm(24, sd = 0.5),
  x = seq(-1, 1, length.out = 24)
)
fit <- drmTMB(bf(y ~ x, sigma ~ x), data = dat)

# One distributional parameter at a time: a named numeric vector.
fixef(fit, "mu")
#> (Intercept)           x 
#>   0.2280971   0.5919767 
coef(fit, "sigma")
#> (Intercept)           x 
#> -0.63277067 -0.01385506 

# Omit `dpar` for every block at once: a named list, one element per
# distributional parameter. `coef()` and `fixef()` return the same structure.
coef(fit)
#> $mu
#> (Intercept)           x 
#>   0.2280971   0.5919767 
#> 
#> $sigma
#> (Intercept)           x 
#> -0.63277067 -0.01385506 
#> 
names(coef(fit))
#> [1] "mu"    "sigma"
identical(coef(fit), fixef(fit))
#> [1] TRUE