Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: can't reproduce bootstrap confidence intervals



Listers,

In an attempt to better understand the percentile methods (particularly the bias-corrected) for bootstrap CIs, I attempted to reproduce them by hand. My results are different from what Stata produces. Can anyone show me my error?

Thanks,
Devra

********
log: d:\temp\biascorr1.log
log type: text
opened on: 5 Jun 2002, 15:46:01

. query born
08 May 2002

. use d:\bstrap4a.dta
(bs: xtnbreg serviol omspl* ddum1 ddum2 ddum3 unionhat totemp loginp firstin dat
> )

.
. summ bs1

Variable | Obs Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
bs1 | 284 -14.43485 6.165848 -30.57345 1.758053

. bstat bs1

Bootstrap statistics

Variable | Reps Observed Bias Std. Err. [95% Conf. Interval]
---------+-------------------------------------------------------------------
bs1 | 284 -11.73766 -2.697188 6.165848 -23.8744 .3990816 (N)
| -25.81105 -1.730178 (P)
| -21.02399 1.758053 (BC)
-----------------------------------------------------------------------------
N = normal, P = percentile, BC = bias-corrected

. scalar define k =r(reps)

. scalar define se=r(se)

. disp r(stat)
-11.737661

. count if bs1<r(stat)
191

. displ r(N)
191

. scalar define n=r(N)

.
. scalar define z0=invnorm(n/k)

. scalar define z95=invnorm(.975)

.
.
. scalar define p1=normprob(2*z0- z95)

. scalar define p2=normprob(2*z0 + z95)

.
. scalar list
p2 = .9978401
p1 = .14318583
z95 = 1.959964
z0 = .44692449
n = 191
se = 6.1658478
k = 284

.
. /*percentile CI*/
. centile bs1, centile (.025, .975)

-- Binom. Interp. --
Variable | Obs Percentile Centile [95% Conf. Interval]
-------------+-------------------------------------------------------------
bs1 | 284 .025 -30.57345 -30.57345 -29.28233*
| .975 -28.39507 -30.57345 -25.96878*

* Lower (upper) confidence limit held at minimum (maximum) of sample

.
. /*bias corrected CI*/
. centile bs1, centile (.14318583)

-- Binom. Interp. --
Variable | Obs Percentile Centile [95% Conf. Interval]
-------------+-------------------------------------------------------------
bs1 | 284 .14319 -30.57345 -30.57345 -28.41841*

* Lower (upper) confidence limit held at minimum (maximum) of sample

.
end of do-file



______________________________________________________________
Devra L. Golbe, Professor
Dept. of Economics
Hunter College / CUNY
695 Park Ave., NY, NY 10021
voice: 212-772-5408
fax: 212-772-5398 (office)
208-361-5964 (e-fax)

http://econ.hunter.cuny.edu/faculty/golbe

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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