ranef.lmm {LMMstar} | R Documentation |
Estimate Random Effect From a Linear Mixed Model
Description
Recover the random effects from the variance-covariance parameter of a linear mixed model.
Usage
## S3 method for class '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,
...
)
Arguments
object |
a |
effects |
[character] should the estimated random effects ( |
scale |
[character] should the total variance, variance relative to each random effect, and residual variance be output ( |
se |
[logical] should standard error and confidence intervals be evaluated using a delta method? Will slow down the execution of the function. |
df |
[logical] Should degrees of freedom, computed using Satterthwaite approximation, be output. |
transform |
[logical] should confidence intervals for the variance estimates (resp. relative variance estimates) be evaluated using a log-transform (resp. atanh transformation)? |
p |
[numeric vector] value of the model coefficients to be used. Only relevant if differs from the fitted values. |
newdata |
[data.frame] dataset relative to which the random effects should be computed. Only relevant if differs from the dataset used to fit the model. |
format |
[character] should each type of random effect be output in a data.frame ( |
simplify |
[logical] when relevant will convert list with a single element to vectors and omit unessential output. |
... |
for internal use. |
Details
Consider the following mixed model:
Y = X\beta + \epsilon = X\beta + Z\eta + \xi
where the variance of \epsilon
is denoted \Omega
,
the variance of \eta
is denoted \Omega_{\eta}
,
and the variance of \xi
is \sigma^2 I
with I
is the identity matrix.
The random effets are estimating according to:
E[Y|\eta] = \Omega_{\eta} Z^{t} \Omega^{-1} (Y-X\beta)
Value
A data.frame or a list depending on the argument format
.
Examples
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")
}