R code error testing measurement invariance

153 views Asked by At

I'm trying to text measurement invariance in a sample with continuous measures, no missing data, and 190 and 208 samples in each group. Whenever I try to test configural invariance I get the following error message:

Error in crossprod(Diff, Sigma.inv) : non-conformable arguments In addition: Warning message: In lavaan::lavaan(model = cfamodel, data = usegrant, group = "RACE_S", : lavaan WARNING: Model estimation FAILED! Returning starting values.

I've copied my code below. I tested the same data in MPlus and was able to run it and get results without issue, but I want to make sure I can get this code to work in R. I've tried quitting and reopening R, updating/uninstalling and reinstalling all the packages and nothing seems to solve the issue. Does anyone have any other ideas to troubleshoot this before I give up and switch to MPlus entirely?

Sample of data: > dput(head(usegrant)) structure(list(...1 = c(1, 2, 3, 5, 6, 7), RACE_3 = c(2, 2, 1, 2, 1, 2), RACE_S = c(2, 2, 1, 2, 1, 2), SOI_01PRE = c(1, 2, 1, 1, 1, 3), SOI_02PRE = c(4, 2, 1, 2, 1, 1), SOI_03PRE = c(3, 2, 1, 2, 1, 2), SOI_04PRE = c(4, 8, 1, 5, 1, 7), SOI_05PRE = c(5, 6, 1, 3, 1, 3), SOI_06PRE = c(5, 5, 1, 7, 1, 3), SOI_07PRE = c(7, 5, 6, 8, 1, 2), SOI_08PRE = c(7, 3, 2, 6, 1, 2), SOI_09PRE = c(6, 5, 2, 8, 1, 2)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))

grant.model<-'
behavior=~SOI_01PRE+SOI_02PRE+SOI_03PRE
attitude=~SOI_04PRE+SOI_05PRE+SOI_06PRE
desire=~SOI_07PRE+SOI_08PRE+SOI_09PRE
behavior~~attitude
attitude~~desire
desire~~behavior'

cfamodel<-cfa(model = grant.model, data=usegrant)
summary(cfamodel, fit.measures=TRUE, standardized=TRUE)

fit.config<-cfa(cfamodel, data=usegrant, group = "RACE_S")```
0

There are 0 answers