-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in fitMeasures after run.mi #134
Comments
These are not the latest software. R is currently 4.3.2, although I don't think that will make any difference. The latest lavaan on CRAN is 0.6-17, and the latest development version of semTools has resolved the issue of the new
If the problem persists, I would need the data to reproduce your example, and the R script you provided would need normal quotation marks instead of the "fancy"/curly quotes around some of the intended character strings (see the ones around "gender" and the one at the end of "participation"). Also, gender is an exogenous predictor, so it should not be placed in the |
Thank you so much for your immediate help. I still get an error along the way! Here is what I did: First, I installed the latest versions of R (4.3.2), lavaan (6-17) and semTools (0.5-6.933). Second, I ran the SEM with imputed data again and got the error below. Model <- ' value =~ X1 + X2 + X3 + X4 + X5 Note: gender and participation are coded dummy variables (0/1) FitModel <- runMI(Model, Error in lav_standardize_all(object, est = est, GLIST = GLIST, partable = partable, : |
I doubt I can track down this error without data to reproduce it. Does the error persist if you have the development version of lavaan installed?
|
Thank you! I installed "yrosseel/lavaan"! Interestingly, the error only persists when I run the model with the additional exogenous variables (gender + education). ####Note. gender and participation are coded as dummies; education (level) is coded numeric FitModel_B <- runMI(Model_B, Error in lav_standardize_all(object, est = est, GLIST = GLIST, partable = partable, : This code works (gender + education excluded): FitModel_A <- runMI(Model_A, |
Try
|
Thank you for your advice. I ran this code and got an error:r error in lav_data_full(data = data, group = group, cluster = cluster, : I have categorised gender as a factor before imputation (see the code below) ####code ###sem sem.mi(Model_B, data = mice.imp1, ordered = "participation", error in lav_data_full(data = data, group = group, cluster = cluster, : |
Well that's obviously a problem. Just do what the error message recommends. I don't know how your factor is coded, but if the labels are "male" and "female", then this could work (for example):
Then just use the dummy code |
Thank you. I tried this and received 12 warnings (see below) ###code ###value labels MyData$gender <- factor(MyData$gender, ###imputation ####add male ###sem fit <- sem.mi(Model_B, data = mice.imp1, ordered = "participation", There were 12 warnings (display with warnings()) summary (fit, fit.measures = TRUE, standardized =T, rsquare=T, ci =T) error in .local(object, ...) : No imputations meet "omit.imps" criteria. summary(warnings(fit)) Summary of (a total of 12) warnings: |
Sorry to ask again. Is there any other way to include dummies (gender) as exogenous factors in the SEM model above? |
Yes, you can, but the warning messages say
because
When you just print
Since there are no _SE_s available, you could remove the second criterion by setting You can investigate further by fitting your model to a single imputed data set, one at a time to at least one of the imputations. Then you'll see more of lavaan's warnings to help diagnose/resolve the issue. One idea would be to equate the loadings of the 2-indicator factor:
without which your model might not be empirically identified (depending on N and how strongly correlated |
Hello everyone,
I am runnning a SEM model based on imputed data.
The code (see below) worked without any problems till approx. September 2023 (R version 4.2).
Now I switched to the latest R version (4.3.0), lavaan (version: 0.6-11.1676), semTools (version: 0.5-6 ) and get this error:
Sadly I can´t run my syntax anymore with the current install and can´t replicate my research.
I would be very grateful for any help and hope I posted the necessary information
Sara
Installed:
install.packages("devtools")
install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source")
install.packages("mice")
install.packages("semTools")
CODE:
The text was updated successfully, but these errors were encountered: