[Mediation-information] possible bug in 'mediation-0.4'

Teppei Yamamoto teppei at MIT.EDU
Mon Mar 26 13:48:48 CEST 2012


Liviu,

> As a user, not as an expert, I find it strange that when estimating
> mediation effects via _bootstrapping_, the actual point estimates
> being displayed via summary() and plot() are NOT those computed from
> the bootstrap estimates.

Using the original data to compute the point estimate along with a 
bootstrap confidence interval is perfectly valid, and the most common 
procedure at least in the applied field I'm familiar with (political 
science).

 > #Indirect Effects of IV on DV through Proposed Mediators (ab paths)
 > #             Data      boot      Bias        SE
 > #EFFICACY     ,0314     ,0270    -,0044     ,0261

This table tells you that the point estimate ("Data") has a NEGATIVE 
bias. So if you want to make a correction you should ADD the estimated 
bias back and correct your estimate upward, not the other way around.

A quick look at Efron and Tibshirani (1994), a standard reference for 
the bootstrap, will probably solve a lot of questions you may have in 
your mind. It's quite accessible to non-experts.

 > # Bias Corrected and Accelerated Confidence Intervals
 > #               Lower     Upper
 > # EFFICACY    -,0039     ,1089

To compute these you would need to go outside of our package.

Now, the question I have to you is, do people in your field routinely 
make bootstrap bias corrections to the estimates? To us this was 
something extra that did not have to come built in the package.

Teppei


>
> In v3.1.2:
>> require(mediation)
> [..]
> Version: 3.1.2
>
> ##estimate m model
>> mod.m<- lm(EFFICACY ~ LEADER + AGE + SEX + DIPLOMA + DEPART + SUPTENURE, indir)
> ##estimate y model
>> mod.y<- lm(CREATIV ~ EFFICACY + LEADER + AGE + SEX + DIPLOMA + DEPART + SUPTENURE, indir)
> ##supply m and y models for mediation analysis
>> med_a<- mediate(mod.m, mod.y, dropobs=T, treat='LEADER', mediator='EFFICACY', boot=T, sims=500)
>> summary(med_a)
>
>   Causal Mediation Analysis
>
> Confidence Intervals Based on Nonparametric Bootstrap
>
> Mediation Effect:  0.02796 95 % CI  -0.02251  0.08666
> Direct Effect:  0.2015 95 % CI  0.06194 0.35702
> Total Effect:  0.2295 95 % CI  0.08975 0.38164
> Proportion of Total Effect via Mediation:  0.1214 95 % CI  -0.1174  0.4886
>
> Sample Size Used: 95
>
>> mean(med_a$d0.sims) #boot/acme
> [1] 0.02795699
>> med_a$d0
> [1] 0.02795699
>
>
> The above summary() seems logical to me, since I computed the
> bootstrapped estimates via mediate(..., boot=TRUE), so I was expecting
> in the summary() to see the average effect as extracted from the
> bootstraps. For what it's worth, this is what the SAS and SPSS macros
> [1] (Preacher&  Hayes, 2008) report when estimating mediation effects
> via bootstrapping:
>
> [1] http://www.afhayes.com/spss-sas-and-mplus-macros-and-code.html
>
>
> In v4.0, however, the same calls as above will result in different
> output (as you explained).
>> require(mediation)
> [..]
> Version: 4.0
>
>> med_a<- mediate(mod.m, mod.y, dropobs=T, treat='LEADER', mediator='EFFICACY', boot=T, sims=500)  ##supply m and y models for mediation analysis
>> summary(med_a)
>
> Causal Mediation Analysis
>
> Confidence Intervals Based on Nonparametric Bootstrap
>
>                           Estimate 95% CI Lower 95% CI Upper p-value
> Mediation Effect           0.0314      -0.0176       0.0790    0.21
> Direct Effect              0.2030       0.0365       0.3853    0.01
> Total Effect               0.2345       0.0712       0.3930    0.01
> Proportion via Mediation   0.1341      -0.0688       0.5223    0.21
>
> Sample Size Used: 95
>
>> mean(med_a$d0.sims) #boot/acme
> [1] 0.02666546
>> med_a$d0 #??bug
> [1] 0.03143479
>
>
> Again, not an expert, but this is not what I've been expecting: the
> 'Estimate 95%' should be '0.0266' instead of '0.0314'. Am I
> misunderstanding something? Perhaps the summary() function should also
> report the bias-corrected estimate?
>
>
>
>> If you do worry about the bias, you can estimate it using the bootstrap
>> draws contained in the output (d0.sims, etc) as
>>
>> d0.bias<- mean(med_a$d0.sim) - med_a$d0
>
>
> Estimating the above yields:
>> (d0.bias<- mean(med_a$d0.sim) - med_a$d0)
> [1] -0.004769328
>
>
>> Then the simplest bias-corrected estimate will be
>>
>> med_a$d0 - d0.bias
>
>
> Do you mean '+' in the above? If I do
>> med_a$d0 - d0.bias
> [1] 0.03620412
>
> However if I do
>> med_a$d0 + d0.bias
> [1] 0.02666546
>
> then I get the same coefficient as in
>> mean(med_a$d0.sims) #boot/acme
> [1] 0.02666546
>
>
> Regards
> Liviu
>
>
>> The previous version of the function computed the estimate differently, but
>> it was NOT a bias-corrected estimate.
>>

-- 
====================================
Teppei Yamamoto
Assistant Professor
Department of Political Science
Massachusetts Institute of Technology
http://web.mit.edu/teppei/www/
====================================


More information about the Mediation-information mailing list