Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <pjones8@uwo.ca>
To   statalist@hsphsun2.harvard.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index