Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[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 <>
Subject   st: Bootstrapping with 'bca' option will not give BCa confidence interval
Date   Mon, 16 Apr 2012 13:04:14 -0400


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
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'


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!


*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index