Centering the Mediator in Multilevel Mediation

708 views
Skip to first unread message

Helena

unread,
Sep 29, 2021, 9:15:41 AM9/29/21
to lavaan

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:

  1. WARNING: model syntax contains variance/covariance/intercept formulas involving (an) exogenous variable(s): [M1.cwc M2.cwc]; These variables will now be treated as random introducing additional free parameters. If you wish to treat those variables as fixed, remove these formulas from the model syntax. Otherwise, consider adding the fixed.x = FALSE option.lavaan
  2. Error in if (fx.delta < tol) { : missing value where TRUE/FALSE needed

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.

Terrence Jorgensen

unread,
Oct 4, 2021, 7:36:59 AM10/4/21
to lavaan

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

You don't have to center anything.  Just include X in the L1 and L2 models, and lavaan will automatically partition its variance into the level-specific components. 
 

But what about the mediator variables? 

Same, don't center it ahead of time, it will be done for you.  



Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Özgür Dünya

unread,
Dec 15, 2022, 7:48:08 AM12/15/22
to lavaan
Hello Dear Terrence,

I'll have restarted the discussion, but I have a similar query about it. Is it necessary to center the interaction term while using 1-1-1 Multilevel moderated mediation? or will it be done for us by lavaan, as in your response to Helena? Thanks a lot.

Özgür

4 Ekim 2021 Pazartesi tarihinde saat 14:36:59 UTC+3 itibarıyla Terrence Jorgensen şunları yazdı:

Terrence Jorgensen

unread,
Jan 18, 2023, 10:04:40 AM1/18/23
to lavaan
Is it necessary to center the interaction term while using 1-1-1 Multilevel moderated mediation? or will it be done for us by lavaan, as in your response to Helena? 

If you include a product term as an observed variable in your model, lavaan just treats that as another observed variable.  If you want it to be double mean centered, then mean center each variable before you calculate the product.  Then enter that product and the uncentered original variables, and they will be decomposed into within/between components as usual.

Özgür Dünya

unread,
Jan 19, 2023, 9:11:39 AM1/19/23
to lavaan
Thank you, dear Terrence. As far as I can tell, centering is not a technique for within and between level decomposition. Therefore we need to center the product term in moderated mediation analysis any case. But does not uncentered product term affect the validity of the results? Or does it simply make the interpretation of the coefficients easier? In my paper, which is in the process of publication, I did my analysis without using any centering technique. I wanted to be prepared in case the rewievers raised this issue.

Thank you for taking the time to answer.

Özgür
18 Ocak 2023 Çarşamba tarihinde saat 18:04:40 UTC+3 itibarıyla Terrence Jorgensen şunları yazdı:

Terrence Jorgensen

unread,
Jan 20, 2023, 9:31:03 AM1/20/23
to lavaan
You're right, my previous post didn't distinguish between grand-mean and cluster-mean centering.  lavaan's decomposition of L1 variables into between/within components (when the variable appears in both models) is analogous to cluster-mean centering.  When I was talking about centering predictors before calculating the product term (not necessary, but an option if you are interested in interpreting the estimated simple effects), that was referring to grand-mean centering.

This article provides a nice discussion of issues to keep in mind:

Reply all
Reply to author
Forward
0 new messages