Statalist The Stata Listserver

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

Re: st: mediation analysis

From   Maarten buis <>
Subject   Re: st: mediation analysis
Date   Thu, 17 May 2007 16:23:29 +0100 (BST)

--- Garth Rauscher <> wrote:
> 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.

It is actually more convenient to write a little program (don't worry,
a program is nothing more than a do-file preceded with 
-program define progname- and ending with -end-). In that program you
would estimate both logistic regressions (on the same bootstrap sample)
and compute the percent difference in odds ratos. You would than feed
this program to -bootstrap- and you are done. See the example below:

*----------- begin example -----------
set more off
sysuse auto, clear
recode rep78 1/3=0 4/5=1
capture program drop difodds
program define difodds, rclass
	logit rep78 foreign
	tempname womed
	scalar `womed' = _b[foreign]
	logit rep78 foreign price mpg
	tempname wmed
	scalar `wmed' = _b[foreign]
	return scalar dif = (`wmed'-`womed')/`womed'*100
bootstrap dif=r(dif), reps(1000): difodds
*---------- end example --------------------
(For more on how to use examples I sent to the Statalist, see )

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
*   For searches and help try:

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