Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lmerG

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

Variance Component Analysis

v1.4.3
GPL (>= 3)
Authors
Andre Schuetzenmeister [aut, cre], Florian Dufey [aut]
Initial release
2020-06-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.