I've run a path analysis using semTools. I'm interested to test indirect effects. I would like to report the results based on Monte Carlo confidence interval. However, the code monteCarloCI(output, standardized = TRUE)
is not able to generate standardized estimates of the coefficients because standardized = TRUE
is only applicable to class lavaan, not lavaan.mi according to the semTools manual. I used the runMi function because I had multiply imputed datasets so I had lavaan.mi object.
I read this post How to use probe2WayMC() with fully standardized solution with semTools / Lavaan R packages?. The suggested solution was to standardize all variables to have SD = 1, and run the analysis again. The standardized estimates would then merely be effect sizes to report along side unstandardized estimates and their tests.
All variables in my model are observed (without latent variables), and continuous.
My question is - is this method applicable to getting standardized estimates of indirect effects using the Monte Carlo method as well? I'm only interested in getting the standardized estimates of indirect effects' coefficients, but it would be great if this method can be used to generate the standardized Monte Carlo confidence interval as well.
Updates: I've included a link to reproducible data and codes below. I got an error message even though I called library(semTools)
before library(lavaan.mi)
. The error message is "Error in monteCarloCI(output, standardized = TRUE) : argument "expr" is missing, with no default".
Link to RDS imputed datasets: https://2ly.link/1yd2r
Codes (shortened version, I included more indirect effects in my codes but they are not the focus of the question so I left them out).
## load packages
library(semTools)
library(lavaan.mi)
## load imputed data
data3t.mi.1 <- readRDS("data3t.RDS")
## make the output of mice for the lavaan.mi function to work
data3t.mi.1 <- NULL
for(i in 1:50) data3t.mi.1[[i]] <- mice::complete(data3t.mi, action=i, inc=FALSE)
## specify my model
model <- '
MRC_Ego_total ~ a1a * ECR_anxiety_average + a2a * ECR_avoidance_average
MRC_Altru_total ~ a1b * ECR_anxiety_average + a2b * ECR_avoidance_average
MRC_provide_total ~ a1c * ECR_anxiety_average + a2c * ECR_avoidance_average
MRC_recog_total ~ a1d * ECR_anxiety_average + a2d * ECR_avoidance_average
MRC_worthy_total ~ a1e * ECR_anxiety_average + a2e * ECR_avoidance_average
TABS_self_total_T ~ d1 * MRC_Ego_total + d3 * MRC_provide_total + d4 * MRC_recog_total
TABS_other_total_T ~ d2 * MRC_Altru_total + d5 * MRC_worthy_total
TABS_self_total_T ~ e1 * ECR_anxiety_average + e3 * ECR_avoidance_average
TABS_other_total_T ~ e2 * ECR_anxiety_average + e4 * ECR_avoidance_average
# outcomes
CBI_total ~ b1 * TABS_self_total_T + b3 * TABS_other_total_T + c1 * ECR_anxiety_average + c3 * ECR_avoidance_average
STSS_total ~ b2 * TABS_self_total_T + b4 * TABS_other_total_T + c2 * ECR_anxiety_average + c4 * ECR_avoidance_average
# variances of exogenous variables
ECR_anxiety_average ~~ v1 * ECR_anxiety_average
ECR_avoidance_average ~~ v2 * ECR_avoidance_average
# covariance of exogenous variables
ECR_anxiety_average ~~ cov1 * ECR_avoidance_average
# variances for endogenous variables (mediators & outcome variables)
MRC_Ego_total ~~ v3 * MRC_Ego_total
MRC_Altru_total ~~ v4 * MRC_Altru_total
MRC_provide_total ~~ v5 * MRC_provide_total
MRC_recog_total ~~ v6 * MRC_recog_total
MRC_worthy_total ~~ v7 * MRC_worthy_total
TABS_self_total_T ~~ v8 * TABS_self_total_T
TABS_other_total_T ~~ v9 * TABS_other_total_T
CBI_total ~~ v10 * CBI_total
STSS_total ~~ v11 * STSS_total
# covariance for endogenous variables (mediators & outcome variables)
MRC_Ego_total ~~ cov2 * MRC_Altru_total + cov3 * MRC_provide_total + cov4 * MRC_recog_total + cov5 * MRC_worthy_total
MRC_Altru_total ~~ cov6 * MRC_provide_total + cov7 * MRC_recog_total + cov8 * MRC_worthy_total
MRC_provide_total ~~ cov9 *MRC_recog_total + cov10 * MRC_worthy_total
MRC_recog_total ~~ cov11 * MRC_worthy_total
TABS_self_total_T ~~ cov12 * TABS_other_total_T
CBI_total ~~ cov13 * STSS_total
# indirect effects
indirect1 := a1a*d1*b1
indirect2 := a1a*d1*b2
indirect3 := a1b*d2*b3
# defined parameters
ECR_an_an := v1
ECR_av_av := v2
'
## the analysis ====
output <- lavaan.mi(model, data=data3t.mi.1, estimator = "MLM", se = "robust.huber.white")
## Monte Carlo CI
monteCarloCI(output, standardized = TRUE)
## the error message is:
Error in monteCarloCI(output2T, standardized = TRUE) :
argument "expr" is missing, with no default
## including "ECR_an_an := v1" and "ECR_av_av := v2" gives an error message. The error message is:
Error in chol.default(varcov) :
the leading minor of order 1 is not positive
lavaan.mi
package: github.com/TDJorgensen/lavaan.mi But it is a lot more complicated than I expected. I am currently waiting to see if my changes tolavaan
are accepted, before I can updatesemTools
accordingly. I will post an answer here when it is ready to install. $\endgroup$missing observed variables in dataset: TABS_self_total TABS_other_total
. The data have similarly named variables with_T
suffix, but when I added that to your model syntax, none of the model's converged on any of the 5 imputations (a minimal example does not require 50 imputations). It would be easier to justsaveRDS(data3t.mi.1)
so I didn't have to spend time on imputation. $\endgroup$_T
suffix to make it match the datasets. $\endgroup$library(semTools)
followed bylibrary(lavaan.mi)
, as well as loadingdata3t.mi.1 <- readRDS("data3t.RDS")
. When I ran those commands, the remainder of your reprex works fine for me. My only attached packages insessionInfo()
arelavaan.mi_0.1-0.0028 semTools_0.5-6.941 lavaan_0.6-19.2150
. $\endgroup$