model <- '
visual =~ a1*x1 + a2*x2 + a3*x3
verbal =~ a4*x4 + a5*x5
texual =~ a6*x6 + a7*x7
verbal ~~ visual
verbal ~ texual + visual
`
indicators <- c("x1", "x2", "x3", "x4", "x5")
latent.v <- c("visual", "verbal", "texual")
lodings <- matrix(c(1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 1, 1), nrow=2, ncol=7, byrow = TRUE)
regressions <- matrix(c(0, 0, 0,
0, 1, 1, 0, 0, 0), nrow=3, ncol=3, byrow = TRUE)
model <- model.maker(indicators , latent.v, loadings, regressions)
Is it possible to make the model definition as a binary matrix?
something like this:
indicators <- c("x1", "x2", "x3", "x4", "x5")
latent.v <- c("visual", "verbal", "texual")
lodings <- matrix(c(1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 1, 1),nrow=2, ncol=7, byrow = TRUE)regressions <- matrix(c(0, 0, 0,
0, 1, 1,0, 0, 0),nrow=3, ncol=3, byrow = TRUE)
I do not know yet whether I can parse the model specified in SimMatrix to lavaan.