Hello all. I have some questions regarding using lavaan for my data. Basically, my aim is to test whether a model fits my data, and more importantly, to see whether age (as a categorical variable) is a moderator, so it's a multi-group path analysis. However, the tricky part is that, to better capture the phenomenon, participants were asked to fill in the questionnarie repeatedly for 6 times, so it sounds like a multilevel analysis too.
My questions are (they are a bit long, hope I have expressed myself well):
1. For lavaan, result of multilevel SEM was reported like a multi-group SEM. Then is it possible to conduct a multi-group SEM on a multilevel model as well? I tried the syntax below, but the error "subscript out of bound" appeared, and I'm not sure if it's because the analysis is not supported, or if there're some issues in my code.
Code sample:
SRSIMCA_md <- '
level: 1
disc_o ~ PI2_c + iden2_c + CEFF_c
PI2_c ~ iden2_c + SR_c
CEFF_c ~ iden2_c + SR_c
iden2_c ~ SR_c
level: 2
disc_o ~ MSR + MPI2 + Miden2 + MCEff'
SRSIMCA_mdfit <- sem(SRSIMCA_d, data = all, cluster = "PartiID", group = "agegp")
2. If multi-group analysis for multilevel model is not supported, do you have some suggestions on what can be done instead? In fact, I have no intention/ prediction on the within- and between-person differences, and I'm only using multilevel SEM because my data are in a nested format (ICC is high too). Personally I have considered using disaggregation approach, but then there is still question.
Here are two codes I tried:
a. randomly trying out if lavaan can take cluster variable into account while not specifying a multilevel model (all variables in the model are on level 1)
SRSIMCA_c_1lv <- '
CAI_o ~ PI2 + iden2 + CEfficacy
PI2 ~ iden2 + SR
CEfficacy ~ iden2 + SR
iden2 ~ SR'
SRSIMCA_c_1lvfit <- sem(SRSIMCA_c_1lv, data = all, cluster = "PartiID")
b. just normal specification
SRSIMCA_c_1lv <- '
CAI_o ~ PI2 + iden2 + CEfficacy
PI2 ~ iden2 + SR
CEfficacy ~ iden2 + SR
iden2 ~ SR'
SRSIMCA_c_1lvfit <- sem(SRSIMCA_c_1lv, data = all)
Code a is just my random testing. The results are essentially the same, but there are still some slight differences. May I confirm if these two codes are doing the same thing (disaggregation)?
Thank you in advance, and sorry if I have only limited knowledge in multilevel/ SEM!