lmerG: Construct Variance-Covariance Matrix of Random Effects for...

View source: R/reml.R

lmerGR Documentation

Construct Variance-Covariance Matrix of Random Effects for Models Fitted by Function 'lmer'

Description

This function restricts the variance-covariance matrix of random effects G to be either diagonal ('cov=FALSE') or to take any non-zero covariances into account (default, 'cov=TRUE').

Usage

lmerG(obj, cov = FALSE)

Arguments

obj

(object) inheriting from class 'lmerMod'

cov

(logical) TRUE = in case of non-zero covariances a block diagonal matrix will be constructed, FALSE = a diagonal matrix with all off-diagonal element being equal to zero will be contructed

Details

This function is not intended to be called directly by users and therefore not exported!

Value

(Matrix) representing the variance-covariance structure of random effects G

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Examples

## Not run: 
library(lme4)
data(Orthodont)
Ortho <- Orthodont
Ortho$age2 <- Ortho$age - 11
Ortho$Subject <- factor(as.character(Ortho$Subject))
fit <-lmer(distance~Sex+Sex:age2+(age2|Subject), Ortho) 
G1 <- VCA:::lmerG(fit, cov=FALSE)
G2 <- VCA:::lmerG(fit, cov=TRUE)
G1[1:10,1:10]
G2[1:10,1:10]

## End(Not run)

VCA documentation built on May 29, 2024, 1:48 a.m.