Error when running sem model for ordinal endogenous variable

321 views
Skip to first unread message

Amanda Hoffman

unread,
May 8, 2019, 9:54:13 PM5/8/19
to lavaan
Below is the code that I am trying to run along with the error message I get. It was running previously, so I'm not sure what little change I made that would affect this.

Thanks in advance for your help!

expcomp is an ordinal variable from 1 to 11

> m4 <- '#measurement component
+        sint =~ NA * senjoy + swaste + sboring + senjoys + fav + least
+        mint =~ NA * menjoy + mwaste + mboring + menjoys + fav + least
+        sint ~~ 1 * sint
+        mint ~~ 1 * mint
+        muti =~ musec + musej + musel
+        suti =~ susec + susej + susel
+        belong =~ NA * safe + proud + talk + schwaste + goodgrades
+        belong ~~ 1 * belong
+        engage =~ hw + paper + books + late
+        musec ~~ susec
+        safe ~~ proud
+        musel ~~ susel
+        swaste ~~ mwaste
+        senjoys ~~ menjoys
+        proud ~~ talk
+        safe ~~ talk
+        musej ~~ susej
+        ##structural component
+        expcomp ~ h * belong + i * engage + c * suti + e * muti
+        engage ~ d * suti + f * muti + g * belong
+        suti ~ a * sint + j * muti
+        muti ~ b * mint
+        #indirect effects
+        ac := a * c
+        adi := a * d * i
+        be := b * e
+        bfi := b * f * i
+        bjc := b * j * c
+        bjdi := b * j * d * i
+        di := d * i 
+        fi := f * i
+        gi := g * i
+        sint ~~ mint'
> m4.fit <- sem(m4, data = dat2)
Error in eigen(VarCov, symmetric = TRUE, only.values = TRUE) : 
  infinite or missing values in 'x'
In addition: Warning message:
In sqrt(A1[[g]]) : NaNs produced

Yves Rosseel

unread,
May 10, 2019, 5:04:50 AM5/10/19
to lav...@googlegroups.com
> > m4.fit <- sem(m4, data = dat2)
> Error in eigen(VarCov, symmetric = TRUE, only.values = TRUE) :
>   infinite or missing values in 'x'
> In addition: Warning message:
> In sqrt(A1[[g]]) : NaNs produced

It looks like this was caused by the 'vcov' check (which was added
relatively recently, hence it may have worked before). You can shut it
off like this:

fit <- sem(...., check.vcov = FALSE)

If this works, then some other problems should be visible in the output
(or in the warning messages).

If you can send me a reproducible example, I can investigate the exact
cause of this error message.

Yves.

Reply all
Reply to author
Forward
0 new messages