JCP 2005-0048-RRRRR Advances in Mediation 1
Appendix A
Obtaining Bootstrapped Percentile and Bias-corrected Confidence Intervals for the Indirect
Effect from Common Data Analysis Software Packages
SPSS v. 12.0
Andrew F. Hayes and Kristopher J. Preacher provide a macro for SPSS that produces
bootstrapped percentile, bias-corrected (BC), and bias-corrected and accelerated (BCa)
confidence intervals for indirect effect models containing observed variables. The macro
can be downloaded free from the following website:
http://www.jcomm.ohio-state.edu/ahayes/SPSS%20programs/indirect.htm
The SPSS syntax below produces bootstrapped percentile, BC, and BCa confidence
intervals for the three-variable mediation model after running the macro obtained from
the website above.
INDIRECT Y=OQ
/X=VAR1
/M=VAR2
/BOOT=1000
/CONF = 95
/PERCENT=1
/BC=1
/BCA=1.
SAS v. 9.1
Hayes and Preacher also provide a macro for SAS that produces the same types of
bootstrapped confidence intervals for indirect effect models containing observed
variables. The macro can be downloaded free from the following website:
http://www.jcomm.ohio-state.edu/ahayes/SPSS%20programs/indirect.htm
The SAS code below produces bootstrapped percentile, BC, and BCa confidence
intervals for the three-variable mediation model after running the macro obtained from
the website above.
%INDIRECT (DATA=WORK.filename, Y=var1, X=var2, M=var3,
BOOT=1000, CONF=95, PERCENT=1, BC=1, BCA=1);
JCP 2005-0048-RRRRR Advances in Mediation 2
LISREL v. 8.54
Bootstrapped percentile and BC confidence intervals are not directly available in
LISREL. However, one can obtain both types of confidence intervals by following the
steps presented below.
1. The following PRELIS syntax will bootstrap the original data and save covariance
matrices from each bootstrapped sample to a single file.
!PRELIS SYNTAX: Can be edited
SY='DRIVE:\filename.PSF'
OU MA=CM IX=123456 XM BS=1000 SF=100 BM=filename.ma
2. The following LISREL syntax runs the model of interest using the covariance matrix
from each bootstrapped sample and saves regression parameter estimates across runs
to a single file.
ESTIMATING PATHS A AND B FOR 1000 SAMPLES OF 60 CASES
DA NI=3 NO=60 RP=1000
LA=LABELS.TXT REWIND
CM=filename.ma
MO NY=3 BE=FU,FI PS=DI,FR
FR BE(2,1) BE(3,1) BE(3,2)
OU BE=filename.BEB XM
3. The following SPSS syntax imports the saved regression parameter estimates from
LISREL into SPSS for further analysis.
GET DATA /TYPE = TXT
/FILE = 'Drive:\filename.BEB'
/DELCASE = VARIABLES 9
/DELIMITERS = " "
/ARRANGEMENT = DELIMITED
/FIRSTCASE = 1
/IMPORTCASE = ALL
/VARIABLES =
V1 11X
V2 11X
V3 11X
Path_a F12.2
V5 11X
V6 11X
Path_c1 F12.2
Path_b F12.2
V9 11X
.
JCP 2005-0048-RRRRR Advances in Mediation 3
CACHE.
EXECUTE.
4. The following SPSS syntax computes the ab cross-product and determines bias in the
centrality of the empirical distribution of ab.
*** Computing a*b across bootstrapped samples ***
COMPUTE ab = Path_a * Path_b .
EXECUTE .
*** Recoding all bootstrapped a*b estimates that are
below the original sample ab value (.01184 in this
example) as “1” ***
RECODE
ab
(Lowest thru .01184=1) (ELSE=0) INTO bias .
EXECUTE .
*** The percentage of "1s" reflects the central tendency
bias (left or right shift) of the empirical ab
distribution ***
FREQUENCIES
VARIABLES=bias
/ORDER= ANALYSIS .
5. Obtain bootstrapped percentile confidence intervals by rank ordering the ab cross-
products and determining the lower and upper bounds as follows:
Lower Limit = value corresponding to ( 2 ) * (# bootstrapped samples)
= .025 * 1000 = 25th rank-ordered value
or the 2.5th percentile of empirical ab distribution
Upper Limit = value corresponding to ( 1 2 ) * (# bootstrapped samples)
= .975 * 1000 = 975th rank-ordered value
or the 97.5th percentile of empirical ab distribution
6. Obtain bootstrapped BC confidence intervals by hand calculating the lower and upper
limits as follows:
(a) Necessary probability values include the normal theory lower and upper limits as
well as the value corresponding to the bias in the empirical ab distribution
obtained through frequencies above:
Probabilities:
LL = 2 = .05 2 = .025
Bias = proportion of bootstrap ab estimates < original sample value for ab = .514
UL = 1 2 = 1.05 2 = .975
JCP 2005-0048-RRRRR Advances in Mediation 4
(b) Obtain standard normal (z) values that correspond to probability values above.
Note that probabilities are cumulative and that corresponding z values can be
obtained through statistical tables or freely available online applets such as the
following:
http://math.uc.edu/~brycw/classes/148/tables.htm
Z values corresponding to cumulative probabilities above:
Normal theory LL = Z.025 = -1.96
Centrality Bias = Z.514 = 0.0351
Normal theory UL = Z.975 = 1.96
(c) Obtain new z values for bias-corrected upper and lower limits as follows (see
MacKinnon et al., 2004):
ZLL = 2(Zbias) + Z/2 = 2(.0351) + (-1.96) = -1.8898
ZUL = 2(Zbias) + Z1-a/2 = 2(.0351) + (1.96) = 2.0302
(d) Obtain percentiles that reflect the bias-corrected confidence limits as follows:
BC Lower Limit = (Cumulative probability of standard normal distribution
corresponding to ZLL) * (100)
= .0294 * 100 = 2.94th percentile of empirical ab distribution
BC Upper Limit = (Cumulative probability of standard normal distribution
corresponding to ZUL) * (100)
= .9788 * 100 = 97.88th percentile of empirical ab distribution
(e) The following SPSS syntax produces the values of the empirical ab distribution
that correspond to the percentile values necessary for the percentile and BC
confidence limits.
FREQUENCIES
VARIABLES=ab /FORMAT=NOTABLE
/PERCENTILES= 2.5 2.94 97.5 97.88
/ORDER= ANALYSIS .
Percentile 95% CI = [.00084, .03787]
Bias-corrected 95% CI = [.00098, .03889]
Mplus v. 3.13
Recent versions of the Mplus software (v. 3.0 or later) can produce bootstrapped
percentile and bias-corrected confidence intervals directly. However, versions later than
3.12 correct an unreported bug in earlier versions that incorrectly computed limits for
JCP 2005-0048-RRRRR Advances in Mediation 5
bootstrapped confidence intervals around indirect effects (L. K. Muthén, personal
communication, September 26, 2005). The following Mplus program code produces bias-
corrected confidence intervals. One obtains bootstrapped percentile intervals by changing
(BCBOOTSTRAP) to (BOOTSTRAP) in the last line of the program.
TITLE: BIAS-CORRECTED CI FOR THREE VARIABLE MODEL
DATA: FILE IS filename.DAT;
FORMAT IS 3F8.2;
VARIABLE: NAMES ARE VAR1 VAR2 VAR3;
ANALYSIS: BOOTSTRAP = 1000;
MODEL: VAR2 ON VAR1;
VAR3 ON VAR2 VAR1;
MODEL INDIRECT:
VAR3 IND VAR2 VAR1;
OUTPUT: SAMP STAND CINTERVAL(BCBOOTSTRAP);
EQS v. 6.1
Bootstrapped percentile and BC confidence intervals are not directly available in EQS.
However, one can obtain both types of confidence intervals by following the steps
presented for obtaining such intervals from the LISREL software package described
above. The following EQS program code bootstraps the original sample and runs the
three-variable mediation model on each bootstrapped sample saving regression parameter
estimates to a single file.
/TITLE
Bootstrapped estimates of ab
/SPECIFICATIONS
DATA='Drive:\Path\filename.ESS';
VARIABLES=3; CASES=60;
METHOD=ML; ANALYSIS=COVARIANCE; MATRIX=RAW;
/LABELS
V1=VAR1; V2=VAR2; V3=VAR3;
/EQUATIONS
V2=*V1+E2;
V3=*V1+*V2+E3;
/VARIANCES
V1 = *;
E2 = *;
E3 = *;
/COVARIANCES
/PRINT
/OUTPUT
Parameters;
Standard Errors;
DATA='EQSOUT.ETS';
JCP 2005-0048-RRRRR Advances in Mediation 6
/SIMULATION
BOOTSTRAP=60;
REPLICATIONS=1000;
SEED=123456789.0;
SAVE=NO;
/END
The lower and upper limits for percentile confidence intervals are those values that
correspond to the 2.5th and 97.5th percentiles of the empirical ab distribution.
The same hand calculation methods described above for the LISREL software package
produce the lower and upper limits for BC confidence intervals. Relevant hand
calculations using the estimates obtained from EQS appear below for expository
purposes.
Normal theory LL = Z.025 = -1.96
Centrality Bias = Z.757 = 0.6967
Normal theory UL = Z.975 = 1.96
ZLL = 2(Zbias) + Z/2 = 2(.6967) + (-1.96) = 0.5666
ZUL = 2(Zbias) + Z1-a/2 = 2(.6967) + (1.96) = 3.3534
BC Lower Limit = (Cumulative probability of standard normal distribution
corresponding to ZLL) * (100)
= .7145 * 100 = 71.45th percentile of empirical ab distribution
BC Upper Limit = (Cumulative probability of standard normal distribution
corresponding to ZUL) * (100)
= .9996 * 100 = 99.96th percentile of empirical ab distribution
Percentile 95% CI = [.00119, .03240]
Bias-corrected 95% CI = [.00958, .05535]
AMOS 5.0
Information presented in the text of the manuscript describes procedures necessary to
obtain both bootstrapped percentile and bias-corrected confidence intervals for indirect
effects using AMOS 5.0.
JCP 2005-0048-RRRRR Advances in Mediation 7
Appendix B
Upper and Lower Limits for Bootstrapped Percentile and Bias-corrected
Confidence Intervals for Mallinckrodt and Wei (2005) Data across Software Packages
Percentile 95% CI Bias-Corrected 95% CI
Software Package LL UL LL UL
Amos 5.0a -.00010 .03574 .00045 .04147
LISREL 8.54 .00084 .03787 .00098 .03889
EQS 6.1 .00119 .03240 .00958 .05535
Mplus 3.13b .000 .038 .000 .040
SAS 9.1 -.00005 .03792 .00042 .03907
SPSS 12.0 -.00011 .03785 .00002 .03899
Note. These estimates are comparable to values shown in the last row of Table 1 for the “a b”
effect.
a
Values for the percentile and bias-corrected confidence limits differ from those reported in the
text because these intervals were obtained from a second random resampling of the original
data.
b
Mplus Version 3 reports output only to three decimal places.
JCP 2005-0048-RRRRR Advances in Mediation 8
Appendix C
Obtaining Bootstrapped Estimates for Specific Indirect Effects in Manifest Variable Models
Containing Multiple Possible Mediators Using Indirect Macros for SPSS and SAS
(Preacher & Hayes, 2005)
Often, researchers wish to examine specific indirect effect pathways within systems that contain
multiple independent and potentially mediating variables such as the system depicted in the
figure below. Preacher and Hayes provide macro code available for free downloading that
implements bootstrap resampling methods to examine such indirect effects within systems of
manifest variables using either the SPSS or SAS software package.
IV1 M1
DV
IV2 M2
Suppose one were interested in examining the indirect effect of IV1 on the DV through both
proposed mediating variables (M1 and M2) but wanted to do so including shared covariance in
the system due to direct and indirect effects linked with IV2. To do so using Preacher and Hayes’
macro, one would specify IV1 as the independent variable, M1 and M2 as the potential mediating
variables, and DV as the outcome of interest. Specification of IV2 as a covariate would yield
bootstrap estimates for the two indirect effects (IV1 → M1 → DV and IV1 → M2 → DV) of
interest net of any influences due to IV2. One could examine additional specific indirect effects
statistically controlling for other variables in the system in a similar manner. Code necessary to
assess the two indirect effects listed above (IV1 → M1 → DV and IV1 → M2 → DV) controlling
for influences due to IV2 appears below for both SPSS and SAS. Note that one must run the
initial Indirect macro code corresponding to one’s preferred statistical software package (SPSS
or SAS) before running the following code.
SPSS Code SAS Code
INDIRECT y = DV %indirect
/x = IV1 (data=filename,y=DV,
/m = M1 M2 IV2 x=IV1,m=M1 M2 IV2,
/c = 1 c=1,
/boot = 1000 boot=1000,
/conf = 95 conf=95,
/normal = 1 normal=1,
/percent = 1 percent=1,
/bc = 1 bc=1,
/bca = 1 bca=1);