Bookmark and Share

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: Determining the 95% CI of the difference in medians using bootstrapping - is this code correct?


From   Philip Jones <[email protected]>
To   [email protected]
Subject   st: Determining the 95% CI of the difference in medians using bootstrapping - is this code correct?
Date   Mon, 19 Sep 2011 07:15:16 -0400

Hi all,

I am using bootstrapping to estimate the 95% CI of the difference in medians in a right-skewed continuous variable (time-to-insertion, or 'tti').

I would appreciate any comments on the following code that (I think!) computes the 95% CI of the difference in medians of the two groups in the study. The code obtains the median of each of the two groups in my dataset, computes the difference between medians, and then runs 1000 repetitions on the code in order to obtain a Normal-based 95% CI of the difference in medians.

 program mydifference, rclass
          version 11
          quietly summarize tti if group==1, detail
          local tti_group1 = r(p50)
          quietly summarize tti if group==2, detail
          local tti_group2 = r(p50)
          return scalar difference = `tti_group1'-`tti_group2'
  end

bootstrap r(difference), rep(1000): mydifference

Many thanks for any comments about whether or not I am doing what I think I am doing.

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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index