Hi,

I would like to conduct a mediation analysis with standardized coefficients.

Since my data set contains missing data, I impute them with MICE multiple imputation. For me, it makes sense to standardize my variables after imputation.

This is the code I used for z-standardisation:

#--- impute data df

imp <- mice(df, m=5, seed = 1234)

complete(imp)

#--- convert into datlist

datlist <- miceadds::mids2datlist(imp)

#--- scale datlist (only numeric variables: 1-7)

vars <- colnames(df[,1:7] )

sdatlist <- miceadds::scale_datlist(datlist, orig_var=vars, trafo_var=paste0("z",vars))

#--- reconvert to mids object

imp2 <- miceadds::datlist2mids(sdatlist)

imp2

complete(imp2)

Now I would like to use the imputed datasets with the standardized variable for my mediation.

This is the code I intend to use for the mediation:

mediation <-'

scaleQIDS_t1 ~ direfModuleEr + bWAI_P + QIDS_t0 + eCoach.d2 + eCoach.d3 + eCoach.d4 +

eCoach.d5 + eCoach.d6 + eCoach.d7 + eCoach.d8 + eCoach.d9 + eCoach.d10

WAI_P ~ a*ModuleEr + QIDS_t0 + eCoach.d2 + eCoach.d3 + eCoach.d4 +
eCoach.d5 + eCoach.d6 + eCoach.d7 + eCoach.d8 + eCoach.d9 + eCoach.d10
indef := a*b

total := indef + diref

'

# analysis based on all imputed datasets

mod6b <- lapply( imp3 , FUN = function(data){

res <- lavaan::sem(mediation , data = df )

return(res)

} )

# extract all parameters

qhat <- lapply( mod6b , FUN = function(ll){

h1 <- lavaan::parameterEstimates(ll)

parnames <- paste0( h1$lhs , h1$op , h1$rhs )

v1 <- h1$est

names(v1) <- parnames

return(v1)

} )

se <- lapply( mod6b , FUN = function(ll){

h1 <- lavaan::parameterEstimates(ll)

parnames <- paste0( h1$lhs , h1$op , h1$rhs )

v1 <- h1$se

names(v1) <- parnames

return(v1)

} )

Unfortunately, the code refers to the original data df with missing data. df does not yet contain any standardizes zVariables. so if I would write zQIDS_t1 in my mediation model, it wouldn't work..

so here is my question:

How can I obtain standardized coefficients of my mediation model after multiple imputation.

Thanks a lot!