# ranef.lmm: Estimate Random Effect From a Linear Mixed Model In LMMstar: Repeated Measurement Models for Discrete Times

 ranef.lmm 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",
ci = FALSE,
transform = (effects == "variance"),
p = NULL,
format = "long",
simplify = TRUE,
...
)


### Arguments

 object a lmm object. effects [character] should the estimated random effects ("mean") or the estimated variance of the random effects ("variance") be output? ci [logical] should standard error and confidence intervals be evaluated using a delta method? Will slow down the execution of the function. 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. format [character] should each type of random effect be output in a data.frame (format="long") 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 = "variance")

}


LMMstar documentation built on Nov. 9, 2023, 1:06 a.m.