Testing for mediating and
moderating effects with SAS
Contingency / elaboration /
3rd variable models
One best management practice vs. contingency perspective
Failure to find main effects -> use of moderators
More than 50% of empirical strategy research have a contingency element
nowadays
− Venkatraman 1989 main types:
− Interaction moderation
− Subgroup moderation
− Mediation
− Configurations, gestalt (cluster analysis)
Footer
Contingency / elaboration /
3rd variable models
Fairchild et al 2007, Annual Review of Psychology 58: 593-614
Third variable could be
- Mediator x-> z -> y
- Confounding variable x <- z -> y (lead to spurious x-y relationship)
- Covariate x -> y <- z or z -> x -> y
- Moderator / interaction
Footer
Mediation
Mediation
Mathieu et al 2008, Org. Res. Meth.
http://davidakenny.net/cm/mediate.htm
− X -> M -> Y
− Underlying mechanism through which X predicts Y
− Baron & Kenny (1986) Journal Of Personality and Social
Psych., 51, 1173-1182
Mediation, examples
Mathieu et al 2008, Org. Res. Meth.
−
−
−
−
−
Structure – strategy – performance (IO paradigm)
Strategy – structure – performance (Chandler)
Theory of reasoned action (Ajzen)
Technology adoption model (Davis)
RBV
Mediation
e3
Mediating variable M
a
b
e2
Independent variable X
Dependent variable Y
c’
1)
2)
3)
Y = i1 + cX + e1
Y = i2 + c’X + bM + e2
M = i3 + aX + e3
Mediation
Causal steps (Baron & Kenny 1986):
1) Y = i1 + cX + e1
2) Y = i2 + c’X + bM + e2
3) M = i3 + aX + e3
Full of partial mediation exists when…
1) c is significant
2) a is significant
3) b is significant
4) c’ is smaller than c
9
Mediation, assumptions
1)
2)
3)
4)
Residuals in eq 2 and 3 are independent
M and residual in eq 2 are independent
No XM interaction in eq 2
No misspecification
1) Causal order x->m->y not y->m->x
2) Causal direction m<->y
3) Unmeasured variables
4) Measurement error
10
Size of Mediation, indirect effect
total effect = direct effect + indirect effect
c = c’ + ab
You can calculate either c – c’ from equations 1 and 2
or ab from equations 2 and 3 and test for
significance using z-distribution
Standard error for the indirect effect by Sobel 1982,
works ok with samples n>100, but is very
conservative (low power)
 ab 
 ab   b a
2
2
2
2
Sobel test tool in web
http://quantpsy.org/sobel/sobel.htm
11
Mediation examples
Pierce et al. (2004) Work environment structure
and psychological ownership: the mediating
effects of control. The journal of social
psychology, 144(5):507-534 Linear regression
Gassenheimer & Manolis (2001) The influence of
product customization and supplier selection on
future intentions: the mediating effects of
salesperson and organizational trust. Journal of
managerial issues, 13(4):418-435 LISREL
12
Mediation, example
Pierce et al 2004
Hypothesis A: control mediates the relationship between WES and ownership
Hypothesis B: control mediates the relationship between tech and ownership
step
Criterion
Predictor
b
t
R2
1
Ownership Y
WES X
.35
5.59**
.12
2
Ownership Y
WES X
.17
2.60*
.24
Control M
.39
5.57**
3
Control M
WES X
.46
7.76**
.21
1
Ownership
Techn
.31
4.41**
.10
2
ownership
Techn
.13
1.76
.24
control
.42
5.71**
Techn
.44
6.63**
3
Control
.20
13
Mediation, example with SAS
Assign the library TILTU12
Open the dataset Data_med_mod
Test a model, where knowledge sharing is expected to mediate the effect of
collaboration on innovative performance
- Use the Baron & Kenny causal steps to estimate the model
- Use the Sobel test calculator to test the significance of the indirect effect
14
Step 1
Footer
Step 1
Source
Model
Error
Corrected Total
Analysis of Variance
Sum of
Mean
DF
Squares Square
1
7.28598 7.28598
245 209.38989 0.85465
246 216.67587
F Value
8.53
Root MSE
0.92447 R-Square
0.0336
Dependent Mean
2.80379 Adj R-Sq
0.0297
Coeff Var
Pr > F
0.0038
32.97234
Parameter Estimates
Variable Label
Intercept Intercept
coll_index collaboration
index
Parameter Standard
DF Estimate
Error t Value Pr > |t|
1
2.29459 0.18405 12.47 <.0001
1
0.06623 0.02268
2.92 0.0038
Footer
Step 2
Footer
Step 2
Source
Model
Error
Corrected Total
Analysis of Variance
Sum of
Mean
DF
Squares Square
2 15.12033 7.56016
241 199.51603 0.82787
243 214.63636
F Value
9.13
Root MSE
0.90987 R-Square
0.0704
Dependent Mean
2.80829 Adj R-Sq
0.0627
Coeff Var
Variable
Intercept
coll_index
ks_index
Pr > F
0.0002
32.39954
Parameter Estimates
Parameter
Label
DF
Estimate
Intercept
1
1.44424
collaboration index
1
0.04314
knowledge sharing index
1
0.05013
Footer
Standard
Error
0.33969
0.02515
0.01785
t Value
4.25
1.72
2.81
Pr > |t|
<.0001
0.0876
0.0054
Step 3
Footer
Step 3
Analysis of Variance
Sum of
Squares
624.99711
2851.66696
3476.66406
Source
Model
Error
Corrected Total
DF
1
262
263
Root MSE
Dependent Mean
Coeff Var
3.29912 R-Square
20.71926 Adj R-Sq
15.92299
Variable
Intercept
coll_index
Mean
Square
624.99711
10.88423
F Value
57.42
Pr > F
<.0001
0.1798
0.1766
Parameter Estimates
Parameter Standard
Label
DF
Estimate
Error t Value Pr > |t|
Intercept
1
16.12346
0.63957
25.21 <.0001
collaboration index
1
0.59563
0.07860
7.58 <.0001
Footer
Indirect effect & Sobel test
http://quantpsy.org/sobel/sobel.htm
From the SAS output you get a= .596, b=.05, c=.066 and c’=.043
Input the a value from step 3 and its std error
Input the b value from step 2 and its std error
The calculator shows
-the test statistic z = ab / std error of ab
-std error of ab
-Significance test that ab differs from zero
-Note: the calculator does not show the value of ab (.596 * .05 in this case)
Footer
Indirect effect & Sobel test
http://quantpsy.org/sobel/sobel.htm
Footer
Moderation
Moderation
http://davidakenny.net/cm/moderation.htm
A predictor has a differential effect on the outcome variable depending on the
level of the moderator variable
Guidelines for testing in Sharma et al (1981) JMR 18(3):291-300
Venkatraman 1989, AMR 14:423-444
Related to x and/or y
Not related to x and y
No interaction with x
Intervening,
exogenous,
antecedent,
suppressor, predictor
Homologizer
(influences strength of
x-y relationship)
Interaction with x
Quasi moderator
(influences form of x-y
relationship)
Pure moderator
(influences form of x-y
relationship)
Footer
Moderation
Homologizer:
Error term is function of z, R square is dependent on z
If the sample is split into subgroups according to values of z, we observe
different R squares in the subgroups
Pure and Quasi moderator:
The regression coefficient of x is a function of z
Pure y = a + b1 x + b2 xz or y = a + (b1 + b2 z)x
Quasi y = a + b1 x + b3z + b2xz -> either x or z can be the moderator
A. Subgroup analysis
Split the sample into subgroups based on the moderator (z) and run the xy model separately in each subgroup
Compare the R squares (and/or parameter estimates) of the subgroups,
Chow test can be used for testing the significance of the difference in R
squares
Difference in parameter estimates d= B1 – B2
Standard error of the difference SEd= SQRT (SEB12 + SEB22)
If |d| > 1.96* SEd, it is significant at p<.05
Footer
Moderation
B: MRA (interaction)
The variables should (maybe, see Echambadi & Hess 2004) be mean-centered
(or residual-centered, see Lance 1988) to avoid collinearity
1.
Y = a + b1 x
2.
Y = a + b1 x + b2 z
3.
Y = a + b1 x + b2 z + b3 xz
Interpretation:
Z is a predictor if b3 = 0 and b2 ≠ 0
Z is a pure moderator if b2 = 0 and b3 ≠ 0
Z is a quasi moderator if b2 ≠ 0, ja b3 ≠ 0
Use graphics to help interpretation of results
26
Moderation
27
Moderation
Summary, first run MRA
1.
If xz- interaction is significant
1. If the main effect of z is significant -> quasi
2. If the main effect of z is not significant -> pure
2.
If xz- interaction is not significant
1. If the main effect of z is significant ->predictor
2. If the main effect of z is not significant, and z is unrelated with x -> split
into subgroups based on z and run x-y regression
1. If the R square is different in the subgroups -> homologizer
2. If the R square is not different in the subgroups -> z plays no role
Examples:
Wiklund & Shepherd (2005) Entrepreneurial orientation and small business
performance: a configurational approach. Journal of business venturing,
20(1):71-91
Rasheed (2005) Foreign entry mode and performance: The moderating effects
of environment. Journal of small business management, 43(1):41-54
28
Footer
Footer
SAS example on moderation
- Dataset TAPDATA
- Examine the relationships between an
individual’s sex, height, and the parents’
heights
- Main effects
- Interaction effect of parents’ heights?
- Is sex a moderator, and what type of
moderator?
- First assign the library and then open the
data and create a scatterplot
31
SAS example on moderation
32
SAS example on moderation
33
Data transformations
Create a new file into your library selecting only variables you will need (sukup,
pituus, isanpit, aidipit)
Add a computed column called male, where you have recoded sukup= 2 as 0
Sort the data according to the variable male
34
Main effects
35
Model diagnostics & SAS code
PROC REG DATA=tiltu12.recodedsorted_tap
PLOTS(ONLY)=ALL ;
Linear_Regression_Model: MODEL pituus = male isanpit aidipit
/SELECTION=NONE SCORR1 SCORR2 TOL SPEC
RUN;
;
36
Output
Number of Observations Read
Number of Observations Used
Number of Observations with Missing Values
127
124
3
4.20927 R-Square 0.7569
Root MSE
Dependent Mean 171.33871 Adj R-Sq 0.7509
2.45669
Coeff Var
Analysis of Variance
Sum of
Mean
DF
Squares
Square F Value Pr > F
Source
3 6621.62294 2207.20765
Model
120 2126.15126
17.71793
Error
Corrected Total 123 8747.77419
Test of First and Second
Moment Specification
DF Chi-Square Pr > ChiSq
124.57 <.0001
8
6.66
0.5734
Parameter Estimates
Variable Label DF
1
Intercept Intercep
Parameter
Estimate
Squared
Standar
Squared Semi-partial
d
Semi-partial Corr Type I
Error t Value Pr > |t| Corr Type I
I Tolerance
15.39805
14.02663
12.07190
0.35037
0.54126
0.80985
0.05908
0.07613
1.10
0.2745
.
.
.
14.91 <.0001
5.93 <.0001
7.11 <.0001
0.51938
0.13520
0.10237
0.45004
0.07124
0.10237
0.98437
0.92602
0.91214
t
male
isanpit
aidipit
isanpit
aidipit
1
1
1
Significant model, high R square, homoskedastic, all parameters significant, no
collinearity
37
Centering the data for interaction analysis
38
Build the interaction variable
39
Main effects with centered data
4.20927 R-Square
0.7569
171.33871 Adj R-Sq
0.7509
Root MSE
Dependent Mean
2.45669
Coeff Var
Variable
Intercept
male
stnd_isanpit
stnd_aidipit
Label
Parameter Estimates
Parameter Standard
DF Estimate
Error t Value Pr > |t|
Intercept
Standardized isanpit: mean = 0
Standardized aidipit: mean = 0
1
1
1
1
167.34719
12.07190
0.35037
0.54126
0.46324
0.80985
0.05908
0.07613
361.26
14.91
5.93
7.11
<.0001
<.0001
<.0001
<.0001
40
Test the significance of interaction using SAS code
PROC REG DATA=TILTU12.INTER_STD_TAP
PLOTS(ONLY)=ALL ;
MODEL pituus = male stnd_isanpit stnd_aidipit;
MODEL pituus = male stnd_isanpit stnd_aidipit mom_dad;
test mom_dad=0;
RUN;
41
Output: no interaction
4.22498 R-Square 0.7572
Root MSE
171.33871
Dependent Mean
Adj R-Sq 0.7490
2.46586
Coeff Var
Analysis of Variance
Sum of
Mean
DF
Squares
Square F Value Pr > F
Source
4 6623.57123 1655.89281
Model
119
2124.20296
17.85045
Error
Corrected Total 123 8747.77419
Variable
Intercept
male
stnd_isanpit
stnd_aidipit
mom_dad
92.76 <.0001
Label
Parameter Estimates
Parameter Standard
DF Estimate
Error t Value Pr > |t|
Intercept
Standardized isanpit: mean = 0
Standardized aidipit: mean = 0
1
1
1
1
1
167.30805
12.08258
0.35227
0.54150
0.00380
0.47983
0.81352
0.05958
0.07642
0.01150
348.68
14.85
5.91
7.09
0.33
<.0001
<.0001
<.0001
<.0001
0.7417
Test 1 Results for Dependent Variable pituus
Mean
Source
DF Square F Value Pr > F
1 1.94829
0.11 0.7417
Numerator
Denominator 119 17.85045
42
Plot the interaction
Use the file interaktio_simple.xls
Standard deviations are 6.676 for dad and 5.220 for mom (both
means are 0)
Mean value for Male is .346
unstd.
mean
0,346
0
0
0
0
0
std.dev.
low value high value regr.coeff.
167,308
0,478
-0,132
0,824
12,083
0
0
0
0
0
0
0
0
0
0
0
0
5,22
-5,22
5,22
0,5415
6,676
-6,676
6,676
0,3523
0,0038
178
176
174
172
predicted y
independent
variables
Constant
x1
x2
x3
x4
x5 mom
z1 dad
x5z1-interaction
170
x5 low
168
x5 high
166
164
162
160
z1 low
level of z1
z2 high
43
Subgroup analysis for sex
44
Output: R square seems better for men and mom’s
height more important for men
Number of Observations Read
Number of Observations Used
Number of Observations with Missing Values
Number of Observations Read 83
Number of Observations Used 83
Source
Model
Error
Corrected Total
Analysis of Variance
Sum of
Mean
DF
Squares Square F Value Pr > F
2 1152.63304 576.31652
80 1521.77660 19.02221
82 2674.40964
30.30 <.0001
4.36145 R-Square 0.4310
Root MSE
167.08434
Dependent Mean
Adj R-Sq 0.4168
2.61033
Coeff Var
Variable
Intercept
stnd_isanpit
stnd_aidipit
167.30507
0.32938
0.45014
0.48058
0.07119
0.09590
348.13
4.63
4.69
Analysis of Variance
Sum of
Mean
DF
Squares Square F Value Pr > F
2 1004.19848 502.09924
38 525.70396 13.83431
40 1529.90244
36.29 <.0001
3.71945 R-Square 0.6564
Root MSE
179.95122
Dependent Mean
Adj R-Sq 0.6383
2.06692
Coeff Var
Parameter Estimates
Parameter Standard
DF Estimate
Error t Value Pr > |t|
1
1
1
Source
Model
Error
Corrected Total
44
41
3
<.0001
<.0001
<.0001
Variable
Intercept
stnd_isanpit
stnd_aidipit
Parameter Estimates
Parameter Standard
DF Estimate
Error t Value Pr > |t|
1
1
1
179.23734
0.42680
0.73150
0.59037
0.10251
0.11831
303.60
4.16
6.18
<.0001
0.0002
<.0001
45
Chow test proves that models for men and women
are different (data must be sorted!)
PROC AUTOREG DATA=TILTU12.INTER_STD_TAP
PLOTS(ONLY)=ALL ;
MODEL pituus = stnd_isanpit stnd_aidipit
/CHOW=(83) ;
RUN;
Ordinary Least Squares Estimates
6063.02261 DFE
121
SSE
50.10762 Root MSE
7.07867
MSE
848.67819 AIC
840.217345
SBC
5.97064578
840.417345
MAE
AICC
3.46608523 HQC
843.654339
MAPE
0.7169 Regress R-Square
0.3069
Durbin-Watson
0.3069
Total R-Square
Test
Chow
Structural Change Test
Break
Point Num DF Den DF F Value Pr > F
83
3
Variable
Intercept
stnd_isanpit
stnd_aidipit
118
77.80 <.0001
Parameter Estimates
Standard
Approx
DF Estimate
Error t Value Pr > |t| Variable Label
1
1
1
171.3387
0.3306
0.6825
0.6357
0.0993
0.1270
269.53
3.33
5.37
<.0001
0.0012 Standardized isanpit: mean = 0
<.0001 Standardized aidipit: mean = 0
46
Is the effect of mom different for men and women?
d = bmen – bwomen
Standard error for difference SEd= SQRT (SE
2
2
bmen + SE bwomen )
Test value z= d/ SEd then compare z to
standard normal
d= .73 - .45 = .28
SEd= sqrt (.1182 + .0962)= sqrt (.023)= .152
Z= 1.84 < 1.96 not significant at 5% level
47