n <- 5e1
p <- 3
X.name <- paste0("X",1:p)
link.lvm <- paste0("Y~",X.name)
formula.lvm <- as.formula(paste0("Y~",paste0(X.name,collapse="+")))
m <- lvm(formula.lvm)
distribution(m,~Id) <- Sequence.lvm(0)
set.seed(10)
d <- lava::sim(m,n)
## linear model
e.lm <- lm(formula.lvm,data=d)
info.tempo <- vcov2(e.lm, bias.correct = TRUE)
info.tempo[names(coef(e.lm)),names(coef(e.lm))] - vcov(e.lm)
## latent variable model
e.lvm <- estimate(lvm(formula.lvm),data=d)
vcov.tempo <- vcov2(e.lvm, bias.correct = FALSE)
round(vcov.tempo %*% information(e.lvm), 5)
Run the code above in your browser using DataLab