The slides for this presentation include Mplus code. In 2017 the Mechanisms and Contingencies Lab at Ohio State University released an SPSS macro called MLMED that conducts multilevel mediation analysis. You can learn more about MLMED by visiting Nick Rockwood’s web page at www.njrockwood.com Rockwood, N. J. & Hayes, A. F. (2017, May). MLmed: An SPSS macro for multilevel mediation and conditional process analysis. Poster presented at the annual meeting of the Association of Psychological Science (APS), Boston, MA.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
The slides for this presentation include Mplus code.
In 2017 the Mechanisms and Contingencies Lab at
Ohio State University released an SPSS macro called
MLMED that conducts multilevel mediation
analysis. You can learn more about MLMED by
visiting Nick Rockwood’s web page at
www.njrockwood.com
Rockwood, N. J. & Hayes, A. F. (2017, May). MLmed: An SPSS macro for multilevel mediation and
conditional process analysis. Poster presented at the annual meeting of the Association of Psychological
Science (APS), Boston, MA.
MLmed: An SPSS Macro for Multilevel Mediation andConditional Process AnalysisNicholas J. Rockwood & Andrew F. Hayes
that simplifies the fitting of multilevel media-tion and moderated mediation models, includingmodels containing more than one mediator. Af-ter the model specification, the macro automat-ically performs all of the tedious data manage-ment necessary prior to fitting the model. This in-cludes within-group centering of lower-level pre-dictor variables, creating new variables contain-ing the group means of lower-level predictor vari-ables, and stacking the data as outlined in Bauer,Preacher, and Gil (2006) and their supplementarymaterial to allow for the simultaneous estimationof all parameters in the model.
The output is conveniently separated by equa-tion, which includes a further separation ofbetween-group and within-group effects. Fur-ther, indirect effects, including Monte Carlo con-fidence intervals around these effects, are auto-matically provided. The index of moderated me-diation (Hayes, 2015) is also provided for mod-els involving level-2 moderators of the indirecteffect(s).
Scope of MLmedIn its current form, MLmed can accommodate up tothree continuous, parallel mediators and one continu-ous dependent variable. Up to three level-1 and threelevel-2 covariates can be included. Finally, one level-2 moderator of the a path (X → M ) and one level-2moderator of the b path (M → Y ) can be included.The same variable may moderate both paths. In mod-els containing more than one mediator, only the a andb paths for the first mediator may be moderated. Fur-ther, the direct effect for any model cannot be mod-erated. For those familiar with PROCESS (Hayes,2013), MLmed can handle multilevel models similarto Models 4, 7, 14, 21, and 58. A special multileveltype of Model 74 can also be fit.
Within-group and between-group indirect effects canbe estimated when X , M , and Y all have variabilityat the within-group and between-group levels. MLmedestimates within-group effects by within-group center-ing variables prior to the analysis, and between-groupeffects are estimated using group means. The detailsof this approach can be found in Zhang, Zyphur, andPreacher (2009).
In connection to the multilevel mediation literature,MLmed can handle 1-1-1 and 2-1-1 data designs,where the three numbers refer to the lowest level inwhich X , M , and Y vary.
Basic ModelThe lower level equations for the 1-1-1 multilevel me-diation model using within-group centering are:
Mij = dMj + aj(Xij −X .j) + eij
Yij = dY j + c′j(Xij −X .j) + bj(Mij −M .j) + eij
where X .j and M .j represent the observed groupmeans of X and M , respectively. The upper levelequations are:
dMj = dM + aBX .j + uMj
dY j = dY + c′BX .j + bBM .j + uY j
aj = aW + uaj
bj = bW + ubj
c′j = c′W + uc′j
which disentangles the within-group effects from thebetween-group effects, denoted with the subscripts Wand B, respectively.
The average within-group indirect effect is (Kenny,Korchmaros, & Bolger, 2003; Bauer et al., 2006):
E(ajbj) = ab + σaj,bj
where σaj,bj is the covariance between aj and bj.The between-group indirect effect is (Tofighi, West, &MacKinnon, 2013):
E(aBbB) = aBbB
Multiple MediatorsThe lower level equations for a 1-1-1 parallel media-tion model with k mediators is:
Mpij = dMpj + apj(Xij −X .j) + eij
for p = 1, ..., k.
Yij = dY j + c′j(Xij −X .j)
+
k∑p=1
bpj(Mpij −Mp.j) + eij
The upper level equations, with no level-2 predictorsexcept observed group means are:
dMpj = dMp + aBpX .j + uMpj
for p = 1, ..., k.
dY j = dY + c′BX .j +
k∑p=1
bBpMp.j + uY j
apj = aWp + uapjbpj = bWp + ubpjc′j = c′W + uc′j
for p = 1, ..., k. With k mediators, there are k specificwithin-group and between-group indirect effects.
The average specific within-group indirect effect thatquantifies the within-group indirect effect of X on Ythrough Mh is :
E(aWhbWh) = aWhbWh + σahj,bhj (1)
and the corresponding specific between-group indirecteffect is:
E(aBhbBh) = aBhbBh (2)
Moderated MediationA level-2 variable can moderate both the within-groupand between-group indirect effect. For example, con-sider a level-2 moderator, Q, of the b path. The equa-tions from the basic model remain the same with theexception that:
bj = bW + gb1Qj + ubj
dY j = dY+c′BX .j+bBM .j+gY 3Qj+gY 4M .jQj+uY j
The within-group effect of Xij on Mij is aj = aW +uaj, and the within-group effect of Mij on Yij control-ling for Xij is bj = bW + gb1Qj + ubj, so the averagewithin-group indirect effect of Xij on Yij is:
E(ajbj) = aW bW + aWgb1Qj + σaj,bj (3)
where σaj,bj is the residual covariance between aj andbj after removing the variance explained by Qj.
The within-group index of moderated mediation isaWgb1, as this determines how the indirect effectchanges systematically as a function of Qj.
The between-group effect of Mij on Yij is bB +gY 4Qj, so the between-group indirect effect of Xijon Yij is aB(bB + gY 4Qj) = aBbB + aBgY 4Qj andthe between-group index of moderated mediation isaBgY 4.
NOTE: First Within- Indirect Effect is Conditional on a Moderator Value of:value
Modvar 10.0000
Within- Indirect Effect(s)E(ab) Var(ab) SD(ab)
Mvar 1.8835 4.3029 2.0743
Within- Indirect Effect(s)Effect SE Z p MCLL MCUL
Mvar 1.8835 .5673 3.3204 .0009 .8528 3.0982
Between- Indirect Effect(s)Effect SE Z p MCLL MCUL
Mvar -.0614 .7419 -.0827 .9341 -1.7720 1.5077
*Some sections of output were removed due to space constraints.
ReferencesBauer, D. J., Preacher, K. J., & Gil, K. M. (2006). Conceptualizing and testing random indirect effects and
moderated mediation in multilevel models: new procedures and recommendations. PsychologicalMethods, 11(2), 142–163.
Hayes, A. F. (2013). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach. Guilford Press.
Hayes, A. F. (2015). An index and test of linear moderated mediation. Multivariate Behavioral Research, 50(1),1–22.
Kenny, D. A., Korchmaros, J. D., & Bolger, N. (2003). Lower level mediation in multilevel models. Psychologi-cal Methods, 8(2), 115–128.
Tofighi, D., West, S. G., & MacKinnon, D. P. (2013). Multilevel mediation analysis: The effects of omittedvariables in the 1–1–1 model. British Journal of Mathematical and Statistical Psychology, 66(2),290–307.
Zhang, Z., Zyphur, M. J., & Preacher, K. J. (2009). Testing multilevel mediation using hierarchical linear modelsproblems and solutions. Organizational Research Methods, 12(4), 695–719.
To download MLmed and its userguide, please visit
njrockwood.com/mlmedor scan this QR code.
3/13/2014
1
Multilevel Mediation Analysis
Andrew F. Hayes The Ohio State University
www.afhayes.com
Workshop Presented at the Association for Psychological Science, Washington DC, 23 May 2013 Sponsored by the Association for Psychological Science and the Society for Multivariate Experimental Psychology (SMEP)
Updated 13 March2014
We will (and will not)…
• …focus (with one exception) on “lower-level” mediation, with “nesting” of
the data part nuisance but partly or mostly an opportunity
• …do a brief review of principles of single-level statistical mediation analysis.
• …extend those principles to multilevel analysis, where components of the
process modeled are allowed to vary between higher-order levels of analysis.
• …describe the equations and some Mplus code for estimating the models.
• …focus entirely on continuous mediators and outcome.
TOTAL -2.956 -0.441 0.754 7.448 14.008 15.251 17.723
b = 1.356, p < .001 c'= 0.316, p = 0.94
a = 5.259, p < .001
ab
95% bootstrap CI
ab = 7.132, p < .001
3/13/2014
8
X Y M a = 5.26 b = 1.36
c' = 0.32, p = 0.94
Single Level Mediation Analysis Summary
TRAINING PPART VOLINFO
We have coded the groups so that they differ by one unit on X, so the direct and
indirect effects can be interpreted as mean differences:
Those who attended the seminar received 7.13 units more information from their
doctor, on average, than those who did not (bootstrap CI = 4.45 to 10.49) by increasing
participation during the interview (because a is positive), and this increased
participation was associated with more information provided by the doctor (because
b is positive).
There is no evidence that, on average, attending the seminar influenced how much the
doctor volunteered relative to those who did not attend independent of this patient
participation mechanism (c' = 0.32, p = 0.94).
TIP: Get in the habit of coding a dichotomous variable by a one-unit difference (e.g., 0/1
or -0.5/0.5) so that its direct and indirect effects can be interpreted as a mean difference.
Avoid reporting standardized effects involving a dichotomous predictor.
(Some) Problems With This Analysis
(1) Violation of the assumption of independence of errors
(2) All effects are assumed to be the same across doctors.
Although these aren’t the only problems (e.g., we can’t necessarily interpret the association
between M and Y in causal terms), these ones we can at least deal with more rigorously using
an alternative statistical approach that respects the nesting of patients under doctors.
Standard error estimators used in OLS and ML programs typically assume independence
of errors in the estimation of M and Y. This is likely violated with nested data when “context” is
ignored. The standard error estimator is biased (usually downward) in this situation.
e.g., some physicians likely volunteer more than other physicians regardless of the behavior of his/her
patients, or attract patients that are more inquisitive or communicative than are the patients of
other doctors.
It completely ignores the real likelihood that physicians and their patients behave differently
on average (see above), and that some doctors may be more (or less) affected by the training
their patients receive (X→M), or how they respond to the behavior of their patients as a result
(M→Y), relative to other doctors. Treats “context” as ignorable rather than interesting.
3/13/2014
9
A Partial Fix?
X Y M a b
c'
k – 1 dummy codes Dj
iM
k
j
ijjiMi eDfaXiM
1
1
iY
k
j
ijjiiYi eDgbMXciY
1
1
This “fixed effects approach to clustering” models away covariation due to differences
between the k level-2 units on the variables measured. All but one level-2 unit is coded
with a dummy variable and these are included in the models of M and Y. The a, b, and c'
paths can be interpreted as effects after partialing out variation due to level-2 “context”
effects.
This helps with the independence problem, but still assumes a, b, and c' are constant
across level-2 units. When the number of level-2 units is small, this may be the only option
available to you. PROCESS has a simple option for doing it automatically when there are
fewer than 20 level-2 units. This is probably better than ignoring the nesting entirely.
fj gj
A Pure Multilevel Approach
• Allows for the estimation of individual-level data considering both individual
and contextual processes at work simultaneously.
• Independence in estimation errors still assumed, but much of the nonindependence in
single-level analysis of multilevel data is captured by the estimation of certain effects
as varying ‘randomly’ between level-2 units.
• Does not require (though still allows, if desired) assuming individual-level effects are
constant across level-2 units.
• Can “deconflate” individual and contextual effects that otherwise might be mistaken
for each other.
We will consider some mediation models that explicitly consider that doctors differ on
average in how much they volunteer, that patients with different doctors may participate
differently on average, that doctors may be differentially sensitive to how much their
patients participate, and/or that the effectiveness of the training program may differ
between doctors.
3/13/2014
10
Some Notation
X c
c is a fixed effect of X on Y
(i.e., estimated as constant
across level-2 units)
c is a random effect of X on Y
(i.e., estimating as varying
between level-2 units)
cj
Level 2, units denoted j
Level 1, units denoted i
Variables measured on/features of Level-2 units.
Constant for all level-1 units nested under a level-2 unit.
Variables measured on/features of Level-1 units
X
Y
Y
We will not denote intercepts. Assume they are always estimated as random effects--- It generally good practice to estimate intercepts as random in multilevel analysis.
see e.g., Bauer, Preacher, and Gil (2006)
A Handy Visual Representation
X
Y M
a
bj
c'
This model has a random indirect effect through the estimation of the M → Y effect
as varying between level-2 units. An effect that “crosses” from a level-2 to a level-1
variable must be fixed. Thus, the effect of X on M and the direct effect of X on Y are
fixed out of necessity in this model. We will estimate this model later.
This is a “2 – 1 – 1” Multilevel Mediation Model
This diagram is “conceptual”. It does not perfectly correspond to the model that is