Extract the conditional modes and conditional variances of random effects in a formatted or unformatted way.
# S3 method for tramME
ranef(
object,
param = NULL,
newdata = NULL,
fix_smooth = !is.null(newdata),
condVar = FALSE,
raw = FALSE,
...
)
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.
A tramME
object.
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.
An optional data.frame
of new observations for which the
new random effects values are predicted.
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.
If TRUE
, include the conditional variances as attributes.
Only works with raw = FALSE
.
Return the unformatted RE estimates as fitted by the model.
Optional arguments (for consistency with generic)
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.
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
.
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.
data("sleepstudy", package = "lme4")
fit <- BoxCoxME(Reaction ~ Days + (Days | Subject), data = sleepstudy, order = 5)
ranef(fit, raw = TRUE)
ranef(fit)
Run the code above in your browser using DataLab