The function computes the variance matrix of the random effects, the correlations, or the measurement error.
Arguments
- model
an object inheriting from class
hlme,lcmm,Jointlcmmormultlcmmrepresenting a general latent class mixed model.- which
either "random", "cor", "randomY", or "error".
- times1
for
which = "cor", numeric vector containing the times at which the correlation should be computed- times2
for
which = "cor", numeric vector containing the times at which the correlation should be computed- nmes
for
which = "randomY"andwhich = "error", the number of measures (ie, the dimension of the returned variance matrix)
Examples
if (FALSE) { # \dontrun{
## The model
m <- hlme(fixed = Y ~ Time, mixture = ~1, random = ~1, subject = "ID",
ng = 2, cor = BM(Time), data = data_hlme, B = c(0,20,30,-1,5,2,0.1))
## The random effects' variance matrix (the variance of the random intercept )
B <- createVarianceMatrix(m, which = "random")
## The variance of the Brownian motion at time c(1, 2, 3, 4)
W <- createVarianceMatrix(m, which = "cor", times1 = c(1, 2, 3, 4), times2 = c(1, 2, 3, 4))
## The variance of the measurement error at 4 visit times
S <- createVarianceMatrix(m, which = "error", nmes = 4)
## In model "m", the variance matrix of the outcome at times c(1, 2, 3, 4) is:
matrix(1, nrow = 4) %*% B %*% t(matrix(1, nrow = 4)) + W + S
} # }