Hi Yves,
This issue came up in a simsem application: simsem/simsem#82
The user is fitting an empirically underidentified model (essentially a bifactor model with 2 correlated methods, although their syntax indicates they might not recognize it as such), and sim() fails after a replication appears to have lavInspect(fit, "converged"), yet fitMeasures() unexpectedly fails. The dump()ed data and syntax are in this reprex (a .txt file with R syntax, because GitHub won't upload a .R file). I tracked down the error to
At this point, you attempt to extract out$XX3.null, even if out (on Line 350) is a try-error. Perhaps you can simply assign XX3.null and c.hat3.null as NA when you conditionally assign the other values on Line 353? Or add the same if (inherits(out, "try-error")) check on Lines 439-440?
Granted, the results from this replication should probably be ignored in the full simulation, but by default simsem should notice the lack of SEs and exclude this replication from summaries, unless the user specifies otherwise.
Hi Yves, This issue came up in a
simsem
application: simsem/simsem#82The user is fitting an empirically underidentified model (essentially a bifactor model with 2 correlated methods, although their syntax indicates they might not recognize it as such), and
sim()
fails after a replication appears to havelavInspect(fit, "converged")
, yetfitMeasures()
unexpectedly fails. Thedump()
ed data and syntax are in this reprex (a .txt file with R syntax, because GitHub won't upload a .R file). I tracked down the error tohttps://github.com/yrosseel/lavaan/blob/master/R/lav_fit_cfi.R#L439
At this point, you attempt to extract
out$XX3.null
, even ifout
(on Line 350) is a try-error. Perhaps you can simply assignXX3.null
andc.hat3.null
asNA
when you conditionally assign the other values on Line 353? Or add the sameif (inherits(out, "try-error"))
check on Lines 439-440?Granted, the results from this replication should probably be ignored in the full simulation, but by default
simsem
should notice the lack of SEs and exclude this replication from summaries, unless the user specifies otherwise.Thanks!