Last chance! 50% off unlimited learning
Sale ends in
Recover the random effects from the variance-covariance parameter of a linear mixed model.
# S3 method for lmm
ranef(
object,
effects = "mean",
scale = "absolute",
se = FALSE,
df = NULL,
transform = (effects %in% c("std", "variance")),
p = NULL,
newdata = NULL,
format = "long",
simplify = TRUE,
...
)
A data.frame or a list depending on the argument format
.
a lmm
object.
[character] should the estimated random effects ("mean"
) or the estimated variance/standard deviation of the random effects ("variance"
,"std"
) be output?
[character] should the total variance, variance relative to each random effect, and residual variance be output ("absolute"
).
Or the ratio of these variances relative to the total variance ("relative"
).
[logical] should standard error and confidence intervals be evaluated using a delta method? Will slow down the execution of the function.
[logical] Should degrees of freedom, computed using Satterthwaite approximation, be output.
[logical] should confidence intervals for the variance estimates (resp. relative variance estimates) be evaluated using a log-transform (resp. atanh transformation)?
[numeric vector] value of the model coefficients to be used. Only relevant if differs from the fitted values.
[data.frame] dataset relative to which the random effects should be computed. Only relevant if differs from the dataset used to fit the model.
[character] should each type of random effect be output in a data.frame (format="long"
)
[logical] when relevant will convert list with a single element to vectors and omit unessential output.
for internal use.
Consider the following mixed model:
The random effets are estimating according to:
if(require(nlme)){
data(gastricbypassL, package = "LMMstar")
## random intercept
e.RI <- lmm(weight ~ time + (1|id), data = gastricbypassL)
ranef(e.RI, effects = "mean")
ranef(e.RI, effects = "mean", se = TRUE)
ranef(e.RI, effects = "variance")
ranef(e.RI, effects = "variance", format = "wide")
}
Run the code above in your browser using DataLab