Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: bootstrapping question
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: bootstrapping question
Date
Wed, 11 Sep 2013 16:32:53 +0200
On Wed, Sep 11, 2013 at 4:14 PM, Shuaizhang Feng wrote:
> I have a question on using bootstrap to generate standard errors.
> Suppose I have a sample of size N, with three variables: x1, x2, and
> x3, all of them are zero/one dummies. Further, for any observation:
> x1+x2+x3=1. What i am interested is m=sum(x1)/sum(x2), or
> equivalently m=mean(x1)/mean(x2). how can i use stata bootstrap
> command to estimate standard errors for m?
The estimate m you are asking for is sometimes called a relative risk
or sometimes an odds. Whatever you call it, it can be estimated as the
exponentiated constant of a multinomial logit model without
covariates. Once you know that, computing regular, robust, bootstrap,
jackknife standard errors is just a matter of specifying the -vce()-
option inside -mlogit-:
*------------------ begin example ------------------
sysuse nlsw88, clear
// lets compute that odds manually:
sum married
tempname m_married
scalar `m_married' = r(mean)
sum never_married
di as txt "manually computed odds: " ///
as result `m_married'/r(mean)
// use mlogit to compute those odds:
gen byte marst = !never_married + married ///
if !missing(never_married, married)
label variable marst "marital status"
label define marst 0 "never married" ///
1 "divorced or widowed" ///
2 "married"
label value marst marst
mlogit marst, base(0) rrr
// do the bootstrap
mlogit marst, base(0) rrr vce(bootstrap, reps(100))
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/