getVarCov: Extract The Residuals Variance-Covariance Matrix From a...

Description Usage Arguments Value Examples

Description

Extract the unique set of residuals variance-covariance matrices or the one relative to specific clusters.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'lmm'
getVarCov(
  obj,
  individual = NULL,
  p = NULL,
  simplifies = TRUE,
  strata = NULL,
  ...
)

Arguments

obj

a lmm object.

individual

[character] identifier of the cluster for which to extract the residual variance-covariance matrix.

p

[numeric vector] value of the model coefficients at which to evaluate the residual variance-covariance matrix. Only relevant if differs from the fitted values.

simplifies

[logical] When there is only one variance-covariance matrix, output a matrix instead of a list of matrices.

strata

[character vector] When not NULL and argument individual is not specified, only output the residual variance-covariance matrix relative to specific levels of the variable used to stratify the mean and covariance structure.

...

Not used. For compatibility with the generic method.

Value

A list where each element contains a residual variance-covariance matrix. Can also be directly a matrix when argument is simplifies=TRUE and there is a single residual variance-covariance matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## simulate data in the long format
set.seed(10)
dL <- sampleRem(100, n.times = 3, format = "long")

## fit Linear Mixed Model
eUN.lmm <- lmm(Y ~ X1 + X2 + X5, repetition = ~visit|id, structure = "UN", data = dL, df = FALSE)

## extract residuals variance covariance matrix
getVarCov(eUN.lmm)
getVarCov(eUN.lmm, individual = c("1","5"))

LMMstar documentation built on Nov. 5, 2021, 1:07 a.m.