non-conformable arrays error in estfun.lavaan (vuongtest in nonnest2)

364 views
Skip to first unread message

Stefan Vermeent

unread,
Mar 12, 2019, 8:00:54 AM3/12/19
to lavaan
Hi all,

I have two non-nested models that I would like to compare with each other. I found vuongtest() in the nonnest2 package, but when I try to use this I get the following error:

Error in t(X[1]) - lavsamplestats@mean[[g]] %*% J : 
  non-conformable arrays

I have tracked this error to the estfun.lavaan() function, but I can't figure out what is going wrong (it works fine with the examples provided with nonnest2)

My model specifications are as follows:

M1 <- '
V1 =~ NA*X1 + X2 + X3 + X4 + X5 + X6
V2 =~ NA*X7 + X8
V3 =~ NA*X9 + X10
V4 =~ NA*X11 + X12
V5 =~ NA*X13 + X14

X1 ~~ X2

V1 ~~ 1*V1
V2 ~~ 1*V2
V3 ~~ 1*V3
V4 ~~ 1*V4
V5 ~~ 1*V5
'

M2 <- '
V1 =~  NA*X2 + X4 + X11 + X12
V2 =~ NA*X7 + X8
V3 =~ NA*X1 + X3 + X5 + X6     
V4 =~ NA*X9 + X10
V5 =~ NA*X13

X1 ~~ X2

V1 ~~ 1*V1
V2 ~~ 1*V2
V3 ~~ 1*V3
V4 ~~ 1*V4
V5 ~~ 1*V5
'

Thanks in advance,
Stefan

Stefan Vermeent

unread,
Mar 19, 2019, 5:45:35 AM3/19/19
to lavaan
In case anyone else encounters this problem in the future, I figured out the problem: My dataframe still contained some participants with missing values who were not included in the CFA analysis but caused the non-conformable array problem in the vuongtest function.



Op dinsdag 12 maart 2019 13:00:54 UTC+1 schreef Stefan Vermeent:
Reply all
Reply to author
Forward
0 new messages