simsem / semTools

Useful tools for structural equation modeling
75 stars 36 forks source link

Error while using sem.mi #139

Closed MarkHuisman-jme closed 1 month ago

MarkHuisman-jme commented 2 months ago

Hello,

I am running a SEM on an imputed data set using the sem.mi( ) function of the semTools package. LCMmod0 <- sem.mi(mvict13, combined_datasets, m) summary(LCMmod0, rsquare = T, fmi = T)

On my laptop there is no problem at all and results are presented, although the versions of R and the packages semTools and lavaan are somewhat old (not too old though; R 4.2.2, semTools 0.5-6, lavaan 0.6-13). On my desktop (at work), the sem.mi function did not work, and gave the error message Error in slot(value, what) : no slot of name "version" for this object of class "lavaanList"

After updating my desktop to the latest versions (R 4.4.1, semTools 0.5-6, lavaan 0.6-18), this error was fixed (did not appear anymore), but instead the following warning was given, for each imputed dataset (m=10) 1: lavaan->modindices():
the modindices() function ignores equality constraints; use lavTestScore() to assess the impact of releasing one or multiple constraints.

Although i did not ask for modindices, it seems not a problem, and it looks like results are computed. However the summary function gives the following output, and error

summary(LCMmod0) lavaan.mi object based on 10 imputed data sets. See class?lavaan.mi help page for available methods. Convergence information: The model converged on 10 imputed data sets Heywood cases detected for data set(s) 1, 3, 4, 5, 8, 9 These are not necessarily a cause for concern, unless a pooled estimate is also a Heywood case. Rubin's (1987) rules were used to pool point and SE estimates across 10 imputed data sets, and to calculate degrees of freedom for each parameter's t test and CI. Parameter Estimates: Error in if (categorical.flag) { : argument is of length zero

Fitmeasures can be obtained with the fitMeasures( ) function, but parameter estimates are not computed. Is this a bug, or did I something wrong? As I said before, older versions on my laptop gave (seemingly good) results.

Best, Mark

TDJorgensen commented 2 months ago

Error in if (categorical.flag) { : argument is of length zero

If you install the GitHub version, this has been resolved. But the lavaan.mi functionality has been deprecated. I have updated much functionality in the new lavaan.mi package, which you can also install from GitHub: https://github.com/TDJorgensen/lavaan.mi

There are still a couple of things to resolve before I can finally send these new versions to CRAN.

MarkHuisman-jme commented 2 months ago

Thanks!