Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic BCa for ratio of bootstrapped values from 2 samples

    Hi Statalisters,

    Apologies if answered elsewhere - have looked. Using version 12.

    Is it possible to automatically generate the bias-corrected accelerated confidence interval for the mean of a ratio which has both sides generated from 2 different samples?

    The process is as follows:

    Code:
    bs, saving (bsx0.dta) bca: mean var1x0 var2x0 //based on sample nx0
    bs, saving (bsx1.dta) bca: mean var1x1 var2x1 //based on sample nx1
    use bsx0.dta, clear
    merge using bsx1.dta
    gen ratio=(var1x1-var1x0)/(var2x1-var2x0)
    Then produce the BCa CI for ratio

    Currently I am doing the final stage manually by estimating the bias and acceleration associated with the newly generated variable using Efron's formulas - as included in [R] bootstrap - where for the acceleration n=nx0+nx1. This is tedious and error-prone.

    Is there a way to do all this automatically using -bootstrap- ?

    I have tried programming the bs, for example:

    Code:
    program ratioest, rclass
    sum var1x0
    local var1x0 = r(mean)
    sum var2x0
    local var2x0 = r(mean)
    sum var1x1
    local var1x1 = r(mean)
    sum var2x1
    local var2x1 = r(mean)
    return scalar ratio = (`var1x1'-`var1x0')/(`var2x1'-`var2x0')
    end
    bs r(ratio), bca: ratioest
    but this does not use the correct samples.

    Thanks in advance,
    Chris
    Last edited by Chris Sampson; 27 Jun 2014, 04:10.
Working...
X