You are on page 1of 9

2014

by Andrew F. Hayes. For online distribution only through www.afhayes.com

Comparing Conditional Effects in Moderated Multiple Regression:


Implementation using PROCESS for SPSS and SAS

Andrew F. Hayes
The Ohio State University
Department of Psychology

This document describes a method for testing the difference between any two conditional effects
of X on Y in a moderated multiple regression model. It is based in part on the approach outlined
by Dawson and Richter (2006) in the Journal of Applied Psychology. It works for continuous or
dichotomous moderators in any combination. Mean centering or standardization is not required,
although substituting mean centered or standardized values in the formulas below does not harm
or alter the derivation and discussion. I conclude with instructions for implementation in
PROCESS for SPSS and SAS as of version 2.12. Version 2.12 is scheduled for release toward
the end of May 2014.

Moderation of Xs Effect by a Single Moderator M

Consider the model

Y = iY+ b1X + b2M + b3XM + eY

In this model, the conditional effect of X on Y is

XY = b1 + b3M

We wish to compare the conditional effect of X on Y when M = m2 to the conditional effect of X


on Y when M = m1. The difference between these conditional effects is

XY = XY | m2 XY | m1
= b3(m2 m1)
The sampling variance of XY is

V(XY) = (m2 m1)2V(b3)

The ratio of XY to the square root of V(XY) is distributed as t(dfresidual) under the null
hypothesis that the two conditional effects are equal, where dfresidual is the residual degrees of
freedom for the model.

But this ratio contains (m2 m1) in both the numerator and the denominator. These cancel each
other and so the ratio simplifies to b3 / V(b3), which is the t-ratio for b3 from the regression
analysis. Thus, an inference that M moderates the effect of X on Y with a test of significance for
the regression coefficient for XM means that any two conditional effects of X defined by
different values of M are significantly different from each other, with the same p-value as the p-
value for b3. Conversely, a failure of M to moderate Xs effect from the test of the regression

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

coefficient for XM implies that no two conditional effects of X defined by different values of M
differ from each other. As no test is needed to compare conditional effects in this model, this
model is not discussed further in this document.

Moderation of Xs Effect Additively by Two Moderators M and W

Next consider the model

Y = iY+ b1X + b2M + b3W + b4XM + b5XW + eY

In this model, the conditional effect of X on Y is

XY = b1 + b4M + b5W

We wish to compare the conditional effect of X on Y when M and W = m2 and w2 to the


conditional effect of X on Y when M and W = m1 and w1. The difference between these
conditional effects is

XY = XY | (m2,w2) XY | (m1,w1)
= b4(m2 m1) + b5(w2 w1)

The sampling variance of XY is

V(XY) = (m2 m1)2V(b4) + (w2 w1)2V(b5) + 2(m2 m1)(w2 w1)COV(b4b5)

The ratio of XY to the square root of V(XY) is distributed as t(dfresidual) under the null
hypothesis that the two conditional effects are equal, where dfresidual is the residual degrees of
freedom for the model.

Two special cases are worth highlighting. If W is held fixed any value, such that w1 = w2 = w,
then
XY = XY | (m2,w) XY | (m1,w)
= b4(m2 m1)

and the sampling variance of XY is

V(XY) = (m2 m1)2V(b4)

By the argument in the prior section, the ratio of the difference in conditional effects of X when
W is held fixed to the standard error of this difference is equivalent to the t statistic for b4. Thus,
the inference about b4 results in an equivalent inference for the difference between any two
conditional effects of X defined by different values of M, regardless of the common value of W.

By the same argument, when M is held fixed at any value such that m1 = m2 = m

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

XY = XY | (m,w2) XY | (m,w1)
= b5(w2 w1)

and the sampling variance of XY is just

V(XY) = (w2 w1)2V(b5)

The ratio of the difference in conditional effects of X when M is held fixed to the standard error
of this difference is equivalent to the t statistic for b5. Thus, the inference about b5 results in an
equivalent inference for the difference between any two conditional effects of X defined by
different values of W, regardless of the common value of M.

Moderation of Xs Effect Multiplicatively by Two Moderators M and W (Moderated


Moderation)

Finally, consider the model

Y = iY+ b1X + b2M + b3W + b4XM + b5XW + b6MW + b7XMW + eY

In this model, the conditional effect of X on Y is

XY = b1 + b4M + b5W + b7MW

We wish to compare the conditional effect of X on Y when M and W = m2 and w2 to the


conditional effect of X on Y when M and W = m1 and w1. The difference between these
conditional effects is

XY = XY | (m2,w2) XY | (m1,w1)
= b4(m2 m1) + b5(w2 w1) + b7(m2w2 m1w1)

The sampling variance of XY is (see the derivation at the end)

V(XY) = (m2 m1)2V(b4) + (w2 w1)2V(b5) + (m2w2 m1w1)2V(b7)


+ 2(m2 m1)(w2 w1)COV(b4b5) + 2(m2 m1)(m2w2
m1w1)COV(b4b7) + 2(w2 w1)(m2w2 m1w1)COV(b5b7)

The ratio of XY to the square root of V(XY) is distributed as t(dfresidual) under the null
hypothesis that the two conditional effects are equal, where dfresidual is the residual degrees of
freedom for the model.

Implementation in PROCESS

PROCESS v2.12 or higher (scheduled for release in May of 2014) can be used to conduct a test
of difference between any two conditional effects of X on Y in additive multiple moderation

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

(PROCESS model 2) or moderated moderation (PROCESS model 3). To do so, first center M
and W around m1 and w1, respectively. Then execute PROCESS model 2 or 3, specifying
contrast=1 and using the mmodval and wmodval commands with mmodval = m and wmodval
= w where m = m2 m1 and w = w2 w1. If you want to fix m2 or w2 to m1 or w1, then use
mmodval = 0 or wmodval = 0, respectively. Because this procedure relies on the mmodval and
wmodval options, it is not available in the custom dialog version of PROCESS for SPSS.

The generic form of the code that accomplishes the analysis in SPSS is
compute mvarc=mvar-m1.
compute wvarc=wvar-w1.
process vars=yvar mvarc wvarc xvar cvarlist/y=yvar/m=mvarc/w=wvarc/model=3/mmodval=mdiff/
/wmodval=wdiff/contrast=1.

where m1 and w1 are m1 and w1, mdiff is a numerical argument set to m2 m1 and wdiff if a
numerical argument set to w2 w1, mvar, wvar, xvar, and yvar are the variable names in the
data corresponding to M, W, X, and Y, and cvarlist is an optional list of covariates. Model=3
can be replaced with model=2 if desired.

The equivalent code in SAS in generic form is

data datafile;set datafile;mvarc=mvar-m1;wvarc=wvar-w1;run;


%process (data=datafile,vars=yvar mvarc wvarc xvar cvarlist,y=yvar,x=xvar,m=mvarc,w=wvarc,
model=3,mmodval=mdiff,wmodval=wdiff,contrast=1);.3308/contrast=1.

Following this procedure will override the defaults in PROCESS such that it will no longer print
the conditional effects of X on Y for various combinations of M and W. Instead, PROCESS will
generate the difference between conditional effects (XY = XY | (m2,w2) XY | (m1,w1)), the
standard error of the difference (V(XY), their ratio as a t statistic, a p-value for testing the
null hypothesis of no difference, and a confidence interval for the difference.

I illustrate using the example from section 9.4 (pp. 307-315) of Introduction to Mediation,
Moderation, and Conditional Process Analysis (Hayes, 2013). In this example, Y is support for
government actions to mitigate the effects of global climate change (govact), X is negative
emotions about climate change (negemot), M is sex (0 = female, 1 = male), and W is age. The
model also includes two covariates: political ideology (ideology) and positive emotions about
climate change (posemot). Of interest is the relationship between support for government action
and negative emotions about climate change with age and sex as moderators.

The model estimated includes a three-way interaction (PROCESS model 3) between X, M, and Y
that is statistically significant. See Figure 9.4 in Hayes (2013) for PROCESS output. Because
age is continuous and sex is dichotomous, PROCESS automatically produces conditional effects
of negative emotions for each group among people relatively younger (1SD below the mean =
33.2054 years), moderate in age (the mean = 49.5362 years) and relatively older (1SD above the
mean = 65.8670 years). The relevant output can be found below.

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

Conditional effect of X on Y at values of the moderator(s):


age sex Effect se t p LLCI ULCI
33.2054 .0000 .3032 .0487 6.2259 .0000 .2076 .3988
33.2054 1.0000 .3942 .0565 6.9713 .0000 .2832 .5052
49.5362 .0000 .3181 .0368 8.6399 .0000 .2459 .3904
49.5362 1.0000 .5182 .0363 14.2841 .0000 .4470 .5894
65.8670 .0000 .3331 .0585 5.6954 .0000 .2183 .4479
65.8670 1.0000 .6422 .0421 15.2609 .0000 .5596 .7248

In this example, we test whether the relationship between negative emotions and support for
government action differs between relatively younger women (m1 = 0, w1 = 33.2054; the first
row above) and men who are moderate in age (m2 = 1, w2 = 49.5362; the fourth row above). As
can be seen from the table of conditional effects above, XY | (m2 = 1, w2 = 44.5362) = 0.5182 and XY
| (m1 = 0, w1 = 33.2054) = 0.3032. Their difference is XY | (m2,w2) XY | (m1,w1) = 0.5182 0.3032 =
0.2150.

The SPSS code below conducts an inferential test that the difference between these conditional
effects of X is equal to zero against the alternative that it is different from zero.
compute sexc=sex-0.
compute agec=age-33.2054.
process vars=govact negemot posemot agec sexc ideology/y=govact/x=negemot/m=sexc/w=agec/model=3
/mmodval=1/wmodval=16.3308/contrast=1.

The equivalent command in PROCESS for SAS is

data glbwarm;set glbwarm;sexc=sex-0;agec=age-33.2054;run;


%process (data=glbwarm,vars=govact negemot posemot agec sexc ideology,y=govact,x=negemot,
m=sexc,w=agec,model=3,mmodval=1,wmodval=16.3308,contrast=1);

This code first centers sex and age around m1 = 0 and w1 = 33.2054, respectively. Obviously,
centering sex around zero doesnt do anything to sex in this case. I include this line of code to
illustrate how the centering is conducted in general. Using these centered moderators in the code
and specifying mmodval = m2 m1 = 1 0 = 1 and wmodval = w2 w1 = 49.5362 33.2054 =
16.3308, along with the contrast=1 option, produces an inferential test of the difference between
XY | (m2 = 1, w2 = 44.5362) and XY | (m1 = 0, w1 = 33.2054).

Most of the output PROCESS generates is not pertinent to the test of interest. What is pertinent
is the section that reads
Contrast of conditional effects of X on Y
Contrast se t p LLCI ULCI
.2150 .0595 3.6158 .0003 .0983 .3317

As can be seen, PROCESS says this difference of 0.215, with a standard error of 0.060, is
statistically significant, t(805) = 3.616, p < .001, with a 95% confidence interval of 0.098 to
0.332.

It is possible using PROCESS to generate the conditional effect of X on Y for any two
combinations of moderators M and W you choose and then conduct a test of the difference
between these conditional effects. You dont have to use the values that PROCESS picks for
you by default. For instance, the SPSS code below estimates the conditional effect of negative

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

emotions on support for government action among 30 year old males (m1 = 1, w1 = 30) as well as
among 50-year old females (m2 = 0, w2 = 50).
process vars=govact negemot posemot age sex ideology/y=govact/x=negemot/m=sex/w=age/model=3
/mmodval=1/wmodval=30.
process vars=govact negemot posemot age sex ideology/y=govact/x=negemot/m=sex/w=age/model=3
/mmodval=0/wmodval=50.

In SAS, use
In
%process (data=glbwarm,vars=govact negemot posemot age sex ideology,y=govact,x=negemot,
m=sex,w=age,model=3,mmodval=1,wmodval=30);
%process (data=glbwarm,vars=govact negemot posemot age sex ideology,y=govact,x=negemot,
m=sex,w=age,model=3,mmodval=0,wmodval=50);

The relevant sections of output are below.


Conditional effect of X on Y at values of the moderator(s):
age sex Effect se t p LLCI ULCI
30.0000 1.0000 .3699 .0620 5.9678 .0000 .2482 .4915

Conditional effect of X on Y at values of the moderator(s):


age sex Effect se t p LLCI ULCI
50.0000 .0000 .3186 .0370 8.6005 .0000 .2459 .3913

The effect of negative emotions on support for government action is 0.3699 among 30 year-old
males (m1 = 1, w1 = 30) and 0.3186 among 50 year-old females (m1 = 0, w2 = 50). Both of these
are statistically different from zero. The difference between them is XY | (m2,w2) XY | (m1,w1) =
0.3186 0.3699 = -0.0513. A statistical test of the between these two conditional effects is
conducted in PROCESS with the code below. In SPSS, use
compute sexc=sex-1.
compute agec=age-30.
process vars=govact negemot posemot agec sexc ideology/y=govact/x=negemot/m=sexc/w=agec/model=3
/mmodval=-1/wmodval=20/contrast=1.

The equivalent code in SAS is


data glbwarm;set glbwarm;sexc=sex-1;agec=age-30;run;
%process (data=glbwarm,vars=govact negemot posemot agec sexc ideology,y=govact,x=negemot,
m=sexc,w=agec,model=3,mmodval=-1,wmodval=20,contrast=1);

This code first centers sex and age around m1 = 1 and w1 = 30, respectively. Using these centered
moderators in the code and specifying mmodval = m2 m1 = 0 1 = -1 and wmodval = w2 w1 =
50 30 = 20 along with the contrast=1 option produces a test of the difference between XY |
(m2,w2) and XY | (m1,w1). The resulting output is

Contrast of conditional effects of X on Y


Contrast se t p LLCI ULCI
-.0513 .0711 -.7215 .4708 -.1908 .0882

This difference of -0.051 has an estimated standard error of 0.071 and is not statistically different
from zero, t(805) = -0.722, p = 0.471, with a 95% confidence interval from -0.191 to 0.088.

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

References

Dawson, J. F., & Richter, A. W. (2006). Probing three-way interactions in moderated multiple
regression: Development and application of a slope difference test. Journal of Applied
Psychology, 91, 917-926.

Hayes, A. F. (2013). Introduction to mediation, moderation, and conditional process analysis: A


regression-based approach. New York: The Guilford Press.

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

Derivation of the Variance of the Difference between Conditional


Effects of X for the Moderated Moderation Model

We seek the sampling variance of b4(m2 m1) + b5(w2 w1) + b7(m2w2 m1w1). We know from
covariance algebra that

V (X ) COV XY COV XZ a
V (aX bY cZ ) = a b c COV XY V (Y ) COVYZ b

COV XZ COVYZ V ( Z ) c

aV ( X ) bCOV XY cCOV XZ

= a b c aCOV XY bV (Y ) cCOVYZ


aCOV XZ bCOVYZ cV ( Z )

a 2V ( X ) abCOV XY acCOV XZ
= abCOV XY b 2V (Y ) bcCOVYZ
acCOV XZ bcCOVYZ c 2V ( Z )

= a2V(X) + b2V(Y) + c2V(Z) + 2abCOVXY + 2acCOVXZ + 2bcCOVYZ

Substitution of values below into the above yields the desired variance.

X = b4
Y = b5
Z = b7
a = (m2 m1)
b = (w2 w1)
c = (m2w2 m1w1)

2014 by Andrew F. Hayes. For online distribution only through www.afhayes.com

Note: If one were to center M and W around m1 and w1 prior to model estimation and express the
conditioning on the centered metric, such that one of the conditional effects is therefore XY |
(0,0) the expressions simplify to
XY = b4m2 + b5w2
V(XY) = m22V(b4) + w22V(b5) + 2m2w2COV(b4b5)

=====
Note: If one were to center M and W around m1 and w1 prior to model estimation and express the
conditioning on the centered metric, such that one of the conditional effects is therefore XY |
(0,0) the expressions simplify to
XY = b4m2 + b5w2 + b7m2w2
V(XY) = m22V(b4) + w22V(b5) + (m2w2)2V(b7) + 2m2w2COV(b4b5)
+ 2m22w2COV(b4b7) + 2m2w22COV(b5b7)

PROCESS v2.11.1 or higher can be used to conduct the test. First center M and W around m1
and w1, respectively. Then execute PROCESS model 3, specifying contrast=1 and using the
mmodval and wmodval commands with mmodval = m and wmodval = w where m = m2
m1 and w = w2 w1. What PROCESS displays as the conditional effect of X on Y along with its
test of significance will actually be the difference between the two conditional effects desired
and a test that their difference equals zero along with a confidence interval for the difference.

You might also like