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]
st: Bootstrapping with 'bca' option will not give BCa confidence interval
From
Philip Jones <[email protected]>
To
[email protected]
Subject
st: Bootstrapping with 'bca' option will not give BCa confidence interval
Date
Mon, 16 Apr 2012 13:04:14 -0400
Hello,
I am trying to use bootstrapping to calculate the difference between two
medians, as in the following program. Unfortunately, even though the code
works correctly, I cannot seem to get BCa confidence intervals, although I can
get every other type of confidence interval.
Note that this problem seems to be the same as experienced in the following
Statalist discussion from 2005
(http://www.stata.com/statalist/archive/2005-12/msg00094.html)
but it doesn't seem to have been resolved as far as I can see.
My code is:
------------
capture program drop mydiff3
program mydiff3, rclass
version 12
gettoken number 0 : 0, parse(" ,")
gettoken grp 0 : 0, parse(" ,")
quietly summarize `number' if `grp'==0, detail
local median_group_hi = r(p50)
quietly summarize `number' if `grp'==1, detail
local median_group_lo = r(p50)
return scalar difference = `median_group_lo'-`median_group_hi'
end
bootstrap r(difference), bca reps(1000) seed(12345) nodots saving(bs, replace) ///
nowarn: mydiff3 dose group
estat bootstrap, all
------------
This is used on a dataset with real numbers as the "number" variable, and an
indicator (0/1) variable ("grp").
I would greatly appreciate any help!
Thanks,
Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/