sigma.lmm | R Documentation |
Extract the unique set of residuals variance-covariance matrices or the one relative to specific clusters.
## S3 method for class 'lmm'
sigma(
object,
cluster = NULL,
p = NULL,
chol = FALSE,
inverse = FALSE,
simplify = TRUE,
...
)
object |
a |
cluster |
[character, data.frame, NULL] identifier of the cluster(s) for which to extract the residual variance-covariance matrix.
For new clusters, a dataset containing the information (cluster, time, strata, ...) to be used to generate the residual variance-covariance matrices.
When |
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. |
chol |
[logical] Output the cholesky factorization of the variance-covariance matrix. |
inverse |
[logical] Output the matrix inverse of the variance-covariance matrix. |
simplify |
[logical] When there is only one variance-covariance matrix, output a matrix instead of a list of matrices. |
... |
Not used. For compatibility with the generic method. |
A list where each element contains a residual variance-covariance matrix.
Can also be directly a matrix when argument is simplify=TRUE
and there is a single residual variance-covariance matrix.
## simulate data in the long format
set.seed(10)
dL <- sampleRem(100, n.times = 3, format = "long")
dL$id.fac <- paste0("id",dL$id)
## fit Linear Mixed Model
eUN.lmm <- lmm(Y ~ X1 + X2 + X5, repetition = ~visit|id.fac,
structure = "UN", data = dL, df = FALSE)
## extract residuals variance covariance matrix
sigma(eUN.lmm) ## unique patterns
sigma(eUN.lmm, cluster = c("id1","id5")) ## existing clusters
sigma(eUN.lmm, cluster = dL[1:7,,drop=FALSE]) ## new clusters
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.