Hello all,
I want to run a parallel mediation analysis with lavaan. My data is nested, so I implement two levels. The mediation is on one level (1-1-1). Because of the nested data, I want to use the group-mean-centered predictor variables (X.cwc) in level 1 and the group means of the predictors (X.cm) in level 2. But what about the mediator variables? They are predictors and outcomes. Should I center the mediators in the whole analysis, like this:
model<-'
level: 1
Y~ b1 * M1.cwc + b2 * M2.cwc + c * X.cwc
M1.cwc~ a1 * X.cwc
M2.cwc~ a2 * X.cwc
#indirect and total effects
ab1:= a1 * b1
ab2:= a2 * b2
totalabc:=ab1+ab2+c
M1.cwc~~M2.cwc
level: 2
Y~ y1 * M1.cm + y2 * M2.cm + z * X.cm
M1.cm~ x1 * X.cm
M2.cm~ x2 * X.cm
#indirect and total effects
xy1:= x1 * y1
xy2:= x2 * y2
totalxyz:= xy1 + xy2 + z
M1.cm~~M2.cm
'
fit<-sem(model,cluster="ID",data=diary, missing='ml')
summary(fit)
Or should the mediators be centered as predictor and uncentered as outcome? Like this:
model<-'
level: 1
Y~ b1 * M1.cwc + b2 * M2.cwc + c * X.cwc
M1~ a1 * X.cwc
M2~ a2 * X.cwc
#indirect and total effects
ab1:= a1 * b1
ab2:= a2 * b2
totalabc:=ab1+ab2+c
M1.cwc~~M2.cwc
level: 2
Y~ y1 * M1.cm + y2 * M2.cm + z * X.cm
M1~ x1 * X.cm
M2~ x2 * X.cm
#indirect and total effects
xy1:= x1 * y1
xy2:= x2 * y2
totalxyz:= xy1 + xy2 + z
M1.cm~~M2.cm
'
fit<-sem(model,cluster="ID",data=diary, missing='ml')
summary(fit)
In the second version I get two error messages:
The problem with the second version is that the centered mediators seem like exogenous variables while they should be endogenous. But on the other hand, in multilevel analysis the outcome shouldn't be centered while the predictor should be centered. I cannot bring these two assumptions together. I also know, if I use the uncentered variables in lavaan, lavaan uses latent group-mean centering. But I don't know how lavaan treats the mediator and if it contains the same problem.
My general question: How do I center the mediator in multilevel analysis?
Thanks in advance. I look forward to your responses.
I want to use the group-mean-centered predictor variables (X.cwc) in level 1 and the group means of the predictors (X.cm) in level 2
But what about the mediator variables?