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.
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.