# MGCFA Problem with generating modification indices for strict invariance

18 views

### Graham Albert

Aug 13, 2018, 1:00:49 PM8/13/18
to lavaan

Hello,

I am relatively new to using lavaan. Currently I am using it to test for measurement invariance between the sexes for a scale that I have developed. I have achieved metric and scalar invariance however I did not achieve strict invariance so I am looking to generate the necessary modification indices so that I can test for partial strict invariance. The model that I am using is:

three.factor.model.='

Factor1=~X1+X5+X7+X8+X9+X12

X9~~X12

X5~~X7

X9~~X7

Factor2=~X10+X8+X4+X14

Factor3=~X13+X11+X6'

I have watched video tutorials on using lavaan and have developed the following:

> partialmod = modindices(strict.fit)

> residuals = partialmod[partialmod\$op=="~~",]

> residuals = partialmod[partialmod\$lhs == partialmod\$rhs,]

> residuals

The purpose of the code is the only show the modification indices for the residuals varirances for the same items between the sexes (e.g., the modification indices for X1 between the sexes, which would look like this X1~~X1). However when I use this code I generate a table with 0 rows in it:

`[1] lhs      op       rhs      block    group    level    mi       epc      sepc.lv  sepc.all sepc.nox`
`<0 rows> (or 0-length row.names)`

I am not sure what I am doing wrong, since I would expect that it should generate 12 modification indices for the 12 residual variances between the sexes.

Any help would be greatly appreciated.

Thank you,

Graham.

### Terrence Jorgensen

Aug 14, 2018, 6:20:22 AM8/14/18
to lavaan

I am not sure what I am doing wrong, since I would expect that it should generate 12 modification indices for the 12 residual variances between the sexes.

But you are estimating all the residual variances.  modindices() is for testing whether a fixed (typically to zero) parameter should be freely estimated.

To test whether an equality constraint should be released, you need to use the more flexible lavTestScore() function.

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