getVarCov2 {lavaSearch2} | R Documentation |
Residual Variance-Covariance Matrix With Small Sample Correction.
Description
Reconstruct the residual variance-covariance matrix from a latent variable model.
It is similar to nlme::getVarCov
but with small sample correction.
Usage
getVarCov2(object, ...)
## S3 method for class 'lvmfit'
getVarCov2(object, ssc = lava.options()$ssc, ...)
## S3 method for class 'lvmfit2'
getVarCov2(object, ...)
Arguments
object |
a |
... |
additional argument passed to |
ssc |
[character] method used to correct the small sample bias of the variance coefficients: no correction ( |
Details
When argument object is a lvmfit
object, the method first calls estimate2
and then extract the residuals.
Value
A matrix with as many rows and column as the number of endogenous variables
Examples
#### simulate data ####
set.seed(10)
n <- 101
Y1 <- rnorm(n, mean = 0)
Y2 <- rnorm(n, mean = 0.3)
Id <- findInterval(runif(n), seq(0.1,1,0.1))
data.df <- rbind(data.frame(Y=Y1,G="1",Id = Id),
data.frame(Y=Y2,G="2",Id = Id)
)
#### latent variable models ####
library(lava)
e.lvm <- estimate(lvm(Y ~ G), data = data.df)
getVarCov2(e.lvm)