Description Usage Arguments Examples
Add columns corresponding to the LPs in the dataset (filled with 0) so that LPs are not treated as a latent variable
1 2 |
x |
|
data |
|
estimator |
|
... |
additional arguments to be passed to the low level functions |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #### regression ####
## simulation
m <- lvm()
m <- regression(m,y='y1',x='x'%++%1:2)
m <- regression(m,y='y1',x='z'%++%1:5)
set.seed(10)
d <- sim(m,150)
## reduced model 1
mR1 <- lvm.reduced()
mR1 <- regression(mR1,y='y1',x='x'%++%1:2)
mR1 <- regression(mR1,y='y1',x='z'%++%1:5, reduce = TRUE)
## reduced model 2
mR2 <- reduce(m)
## check estimation
emGS <- estimate(m, d)
em1 <- estimate(m, d, estimator = "gaussian1")
emR1 <- estimate(mR1, d)
coef(emGS) - coef(em1)
coef(em1) - coef(emR1)[names(coef(em1))]
emR2 <- estimate(mR1, d)
#### latent variable model ####
m <- lvm()
m <- regression(m,y=c('y1','y2','y3','y4'),x='eta')
m <- regression(m,y=c('y2','y3'),x='x'%++%1:5)
latent(m) <- ~eta
m <- regression(m,y=c('y1','y2'),x='z'%++%1:2)
covariance(m) <- y2~y1
# simul
set.seed(10)
d <- sim(m,100)
# reduced model
mR1 <- reduce(m, endo = c("y2"))
mR2 <- reduce(m)
## estimation
em <- estimate(m,d)
emR <- estimate(mR1, data = d)
coef(em)
coef(emR)[names(coef(em))]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.