You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks a lot for creating this wonderful function to simplify the process to generate the Monte Carlo confidence intervals for indirect effects.
In my study, I've used multiple imputations to handle missing data first using the mice package. I then used runMi to conduct a multiple mediation analysis to analyze 5 parallel mediators using the sem function of semTools. After that, I would like to generate the Monte Carlo confidence intervals. However, I'm having the error message below.
Error in names(x) <- wnames :
'names' attribute [1] must be the same length as the vector [0]
Below are the codes I used. In my model, I don't have levels, so I put NULL in the codes. Would this be the problem? If not, would you please advise what's wrong with my code?
## specify the model ====
model1 <- '# total effect
total := c + (a*b1) + (c*b2) + (d*b3) + (e*b4) + (f*b5)
# mediator
IRQ_original_total ~ a*ECR_anxiety_average
IRQ_partner_total ~ c*ECR_anxiety_average
CEER_total ~ d*ECR_anxiety_average
IRIS_total ~ e*ECR_anxiety_average
DERS_total ~ f*ECR_anxiety_average
CTS2_psy_perp_total~ b1*IRQ_original_total
CTS2_psy_perp_total~ b2*IRQ_partner_total
CTS2_psy_perp_total~ b3*CEER_total
CTS2_psy_perp_total~ b4*IRIS_total
CTS2_psy_perp_total~ b5*DERS_total
# direct effect
CTS2_psy_perp_total ~ c*ECR_anxiety_average
# indirect effect (a*b)
ab := a*b1
cb := c*b2
db := d*b3
eb := e*b4
fb := f*b5
'
## run the analysis ====
output <- runMI(model1, data=alldata5.mi.1, fun="sem")
summary(output, standardized=TRUE, fit = TRUE, ci=TRUE)
## robust Monte Carlo confidence intervals of indirect effects ====
install.packages("manymome")
library(manymome)
mc_out <- do_mc(fit = output,
R = 10000,
seed = 1234)
out <- cond_indirect_effects(wlevels = NULL,
x = "ECR_anxiety_average",
y = "CTS2_psy_perp_total",
m = "IRQ_original_total", "IRQ_partner_total", "CEER_total", "IRIS_total", "DERS_total",
fit = output,
mc_ci = TRUE,
mc_out = mc_out)
The text was updated successfully, but these errors were encountered:
First of all, thanks a lot for creating this wonderful function to simplify the process to generate the Monte Carlo confidence intervals for indirect effects.
In my study, I've used multiple imputations to handle missing data first using the mice package. I then used runMi to conduct a multiple mediation analysis to analyze 5 parallel mediators using the sem function of semTools. After that, I would like to generate the Monte Carlo confidence intervals. However, I'm having the error message below.
Below are the codes I used. In my model, I don't have levels, so I put NULL in the codes. Would this be the problem? If not, would you please advise what's wrong with my code?
The text was updated successfully, but these errors were encountered: