Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: mediation analysis

From   "Garth Rauscher" <>
To   <>
Subject   st: mediation analysis
Date   Thu, 17 May 2007 09:57:30 -0500

Dear statalisters,

I have been conducting mediation analyses to determine to what extent
certain social variables can explain why Black women are diagnosed at a
later stage of breast cancer compared to white women.

I am estimating two models...

logit latestage Black, or
logit latestage Black mediator, or

...then calculating the percent reduction in the odds ratio for "Black".

Putting aside issues of whether this is the best method to do such an
analysis (probably not), here is my question: I would like to obtain a
confidence interval for this percent reduction in the odds ratio. I was
thinking of running a bootstrap analysis by sampling with replacement to
re-estimate both models. To do this I would set the seed to be the same for
both models, bootstrap both models and create an output dataset for each,
merge the two output datasets on _obs_, calculate the percent reduction for
each _obs_ then locate the 2.5% and 97.5% tiles of the distribution. Below
is my best guess as to the correct code, which is giving me the error
message "varlist not allowed"

Set seed 123456789
vce(bootstrap,reps(1000) saving(totaleffect)):  logit latestage Black, or
vce(bootstrap,reps(1000) saving(directeffect)): logit latestage Black
mediator, or

Next I would merge these two files on the observation number _obs_. I might
have to rename the parameter for Black for at least one of the files so that
one variable does not overwrite the other during the merge. Assuming the
variable for the parameter for Black is named B1_, this again is my best
guess regarding the correct code (which I cannot check because my prior code
is not working).

use totaleffect, clear
gen B1_ = totaleffect
use directeffect, clear
gen B1_ = directeffect
Merge _obs_ using totaleffect 
Any suggestions regarding how to get this code to work would be much

Also, suggestions regarding other ways to do this in stata would also be

Thanks much, Garth

Garth Rauscher
Assistant Professor
SPH Epidemiology and Biostatistics
University of Illinois at Chicago
1603 W Taylor St (M/C/ 923)
Chicago, IL 60612
(312) 413-4317 phone
(312) 996-0064 fax <>  email 

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index