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