# Multigroup Multilevel CFA

109 views

### Leonie Cloos

May 29, 2020, 12:10:48 PM5/29/20
to lavaan
I am trying to conduct a measurement invariance test on a multilevel CFA model, where I am interested in the Within Person structure of affect, using repeated measures.
I want to compare the within-person measurement model across two groups and therefore saturated the between-person level.

twolevel <- '
group: 1
level: 1
f1 =~ 1*relaxed + a*happy + b*euphoric
f2 =~ 1*depressed + d*stressed + e*anxious + f*anger
level: 2
relaxed ~~ relaxed + happy + euphoric + depressed + stressed + anxious + anger
happy ~~ happy + euphoric + depressed + stressed + anxious + anger
euphoric ~~ euphoric + depressed + stressed + anxious + anger
depressed ~~ depressed + stressed + anxious + anger
stressed ~~ stressed + anxious + anger
anxious ~~ anxious + anger
anger ~~ anger

group: 2
level: 1
f1 =~ 1*relaxed + a*happy + b*euphoric
f2 =~ 1*depressed + d*stressed + e*anxious + f*anger
level: 2
relaxed ~~ relaxed + happy + euphoric + depressed + stressed + anxious + anger
happy ~~ happy + euphoric + depressed + stressed + anxious + anger
euphoric ~~ euphoric + depressed + stressed + anxious + anger
depressed ~~ depressed + stressed + anxious + anger
stressed ~~ stressed + anxious + anger
anxious ~~ anxious + anger
anger ~~ anger
'

results <- cfa(twolevel, data = data, group = "HC", cluster = 'PID', optim.method = "em", group.equal = "loadings")

I am now trying to check for measurement invariance of the loadings on the within person factors and tried the group.equal setting which normally works in a multigroup model, but does not work here...

Is it possible to constrain the loadings at level 1 across the two groups?

### Terrence Jorgensen

May 29, 2020, 5:14:37 PM5/29/20
to lavaan
Is it possible to constrain the loadings at level 1 across the two groups?

Yes, label the parameters in your syntax.

The group.equal= shortcut is not designed to be applied with different "blocks" (the structure in your syntax, where each group and level can have a unique model without shared parameters).  Likewise, you will have to use labels to equate parameters across levels, if you are interested in that (if not, perhaps you should reconsider: https://www.frontiersin.org/articles/10.3389/fpsyg.2017.01640/full ; https://doi.org/10.3102/1076998616646200 )

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