Hi everyone,
I'm new to using lavaan and am trying to specify a serial mediation model, and would really appreciate some advice as to how to potentially adjust for mediator covariance and include covariates in the model.
The model is relatively simple with two serial mediators, and I had initially specified this as follows:
serMedModel <- '
M1 ~ a1 * X
M2 ~ a2 * X + d21 * M1
Y ~ cp * X + b1 * M1 + b2 * M2
ind_eff1 := a1 * b1
ind_eff2 := a2 * b2
ind_eff3 := a1 * d21 * b2
c := cp + a1 * d21 * b2 + a1 * b1 + a2 * b2
'
fit <- lavaan::sem(model = serMedModel, data = df, se = "boot", bootstrap = 5000)
lavaan::parameterEstimates(fit, boot.ci.type = "bca.simple")
Covariance:
However, reading through some conversations I have come across the suggestion that it is generally advised to adjust for covariance of the mediators, by adding the following:
M1 ~~ M2
Would that be correct in this case, or is that only applicable to parallel mediation?
Covariates:
I would also like to re-run the analysis by adjusting for potential covariates. Am I right in thinking that would look something like this, if I were to add three covariates (CV1, CV2, and CV3)?
serMedModelCov <- '
M1 ~ a1 * X + c1 * CV1 + c2 * CV2 + c3 * CV3
M2 ~ a2 * X + d21 * M1 + 45 * CV1 + c5 * CV2 + 6
Y ~ cp * X + b1 * M1 + b2 * M2 + c7 * CV1 + c8 * CV2 + c9
ind_eff1 := a1 * b1
ind_eff2 := a2 * b2
ind_eff3 := a1 * d21 * b2
c := cp + a1 * d21 * b2 + a1 * b1 + a2 * b2
'
I would really appreciate any pointers, I've tried to have a go at it on my own but it'd be great to have some input about whether I'm on the right track! If there are any other details that would be helpful for me to post please do let me know.