# NOT RUN {
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 <- sim(m,n)
## linear model
e.lm <- lm(formula.lvm,data=d)
iid.tempo <- iid2(e.lm, adjust.residuals = FALSE)
range(iid.tempo[,1:4]-iid(e.lm))
## latent variable model
e.lvm <- estimate(lvm(formula.lvm),data=d)
iid.tempo <- iid2(e.lvm, adjust.residuals = FALSE)
range(iid.tempo-iid(e.lvm))
## difference due to the use of the observed info matrix vs. the expected one.
# }
Run the code above in your browser using DataLab