ranef.tramME: Point estimates and conditional variances of random effects.

ranef.tramMER Documentation

Point estimates and conditional variances of random effects.

Description

Extract the conditional modes and conditional variances of random effects in a formatted or unformatted way.

Usage

## S3 method for class 'tramME'
ranef(
  object,
  param = NULL,
  newdata = NULL,
  fix_smooth = !is.null(newdata),
  condVar = FALSE,
  raw = FALSE,
  ...
)

Arguments

object

A tramME object.

param

An optional named list of parameter values (beta and theta). See details. Optionally, gamma elements can also be added, which leads to 'fixing' those random effects terms at the supplied values.

newdata

An optional data.frame of new observations for which the new random effects values are predicted.

fix_smooth

Logical; it is set to TRUE by default, if newdata is supplied. The random effects parameters corresponding the smooth terms are fixed and not fitted (posterior mode) to newdata instead they are treated just like fixed effects parameters. See details.

condVar

If TRUE, include the conditional variances as attributes. Only works with raw = FALSE.

raw

Return the unformatted RE estimates as fitted by the model.

...

Optional arguments (for consistency with generic)

Details

raw = TRUE returns the whole vector of random effects (i.e. with parameters of smooth shift terms), while raw = FALSE only returns the formatted list of actual random effects (i.e. for grouped observations) values. For the conceptual differences between the two types of random effects, see Hodges (2014, Chapter 13).

The conditional variances of the fixed random effects are set to NA.

Value

Depending on the value of raw, either a numeric vector or a ranef.tramME object which contains the conditional mode and variance estimates by grouping factors.

Warning

The function has several optional arguments that allow great flexibilty beyond its most basic usage. The user should be careful with setting these, because some combinations might not return sensical results. Only limited sanity checks are performed.

References

Hodges, James S. (2014). Richly Parameterized Linear Models: Additive, Time Series, and Spatial Models Using Random Effects. Chapman & Hall/CRC Texts in Statistical Science Series.

Examples


data("sleepstudy", package = "lme4")
fit <- BoxCoxME(Reaction ~ Days + (Days | Subject), data = sleepstudy, order = 5)
ranef(fit, raw = TRUE)
ranef(fit)


tramME documentation built on July 9, 2023, 7:10 p.m.