Dear Users,
library(lavaan)
HS.model <- '
group 1:
visual =~ x1 + a*x2 + b*x3
textual =~ x4 + x5 + x6
group 2:
visual =~ x1 + a*x2 + b*x3
speed =~ x7 + x8 + x9
'
fit <- cfa(HS.model, data=HolzingerSwineford1939, group="school")
When I found it, it was working fine! Unfortunately, when running the code now I found out that it doesn't work anymore with the following error code:
Error: all(group %in% partable$group) is not TRUE
One solution I tried which didn't work was to specify one model with parameter constraints. But lavaan doesn't allow for speed to be absent from group 1 and textual from group 2. Further, such a solution is much more cumbersome and it is really easy to make mistakes...
Best,
Johan