Multigroup multilevel SEM - is this possible?

209 views
Skip to first unread message

Robert Udale

unread,
Jul 10, 2019, 5:44:15 AM7/10/19
to lavaan
Hello,

I've been asked to implement the following SEM model:



social_id_model = '

 level: 1
        
        # Latent variables (=~)

        injunctive_norm_general =~    1 * Q36_1 + 1 * Q37_1
        descriptive_norm_general =~   1 * Q38_1 + 1 * Q39_1
        personal_norm_general =~      1 * Q53_1 + 1 * Q54_1
        policy_acceptance         =~  1 * Q64_1 + 1 * Q66_1

        # Regressions (~)

        policy_acceptance ~ Q63_1                
        Q63_1 ~ injunctive_norm_general + descriptive_norm_general + personal_norm_general
        personal_norm_general ~ injunctive_norm_general + descriptive_norm_general
        injunctive_norm_general ~ Q35_1
        descriptive_norm_general ~ Q35_1

        level: 2
        
        # Latent variable
        injunctive_norm_general =~    1 * Q36_1 + 1 * Q37_1
        descriptive_norm_general =~   1 * Q38_1 + 1 * Q39_1
        personal_norm_general =~      1 * Q53_1 + 1 * Q54_1
        policy_acceptance         =~  1 * Q64_1 + 1 * Q66_1
        
        # Regression.
        Q63_1 ~ injunctive_norm_general
        
        # Residual correlations
        injunctive_norm_general ~~ descriptive_norm_general + personal_norm_general
        descriptive_norm_general ~~ personal_norm_general
      

'

social_id_fit = sem(social_id_model, data,  cluster = "country_sample", group = "gWP4")


The data is comprised of responses from 31 countries (country_sample) and is split into three groups (gWP4). 

When I run this code, we get the following error message:


Error in ov.names.l[[g]] : subscript out of bounds
 

What could be causing this error?

Is it possible to do a multi-level and multi-group analysis like this?


jpma...@gmail.com

unread,
Jul 10, 2019, 6:25:16 AM7/10/19
to lav...@googlegroups.com

Hello,

Why the 1*item in your mearusment models? Try to run the models without the “1”…

Best.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/55d4a677-b68b-45f0-a784-f67fa64903b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Terrence Jorgensen

unread,
Jul 13, 2019, 12:13:26 PM7/13/19
to lavaan
Is it possible to do a multi-level and multi-group analysis like this?

Undocumented so far, but yes.  Groups must be considered as fixed, and vary only at Level 2.  So you need to specify blocks for each group, and within each group's block, you specify the Level 1 and Level 2 blocks.  

model <- '
Group: 1

Level: 1

  foo ~ bar

Level: 2

  foo ~ bar



Group: 2

Level: 1

  foo ~ bar

Level: 2

  foo ~ bar


 
Group: 3

Level: 1

  foo ~ bar

Level: 2

  foo ~ bar
'


But you already have a small Level 2 N=31, so splitting that into 3 groups spells disaster.  Even if your model converges, you couldn't trust your results.

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Franzi K.

unread,
Sep 26, 2019, 7:06:07 AM9/26/19
to lavaan
Dear Terrence,

I was wondering which optimizers and estimators might be suitable for having a multi-group multilevel SEM? Moreover, are there any other parameters that enhance running such a model?

Thank you in advance!

Best,
Franzi

Terrence Jorgensen

unread,
Sep 28, 2019, 9:18:56 AM9/28/19
to lavaan
which optimizers and estimators might be suitable for having a multi-group multilevel SEM?

Same options as for single-group MLSEM: maximum likelihood or EM algorithm.

 
Moreover, are there any other parameters that enhance running such a model?

I don't understand your question.

Franzi K.

unread,
Sep 30, 2019, 7:46:31 AM9/30/19
to lavaan
Sorry for the unspecific question, I was rather referring to things I have to specify in the sem()-function but in the end I came to the conclusion that my sample is too small anyway :-(.

Thank you!
Reply all
Reply to author
Forward
0 new messages