Announcement

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

  • Program to compute Bootstrap SE with survey design

    ello, I have been trying to implement a survey design with the arhomme command, which is a user-generated command that computes a selection QCR. However, the arhomme command does not work with the svyset command, so I am looking for a way to incorporate the survey design to compute proper standard errors.

    Below, I have listed the program I have written so far along with the results. I have two questions regarding my approach:
    1. Is this an appropriate method for computing the standard errors?
    2. I encountered an issue when using the n() option in the bstat command. When I tried setting n, I received the following error:
    Code:
    bstat, stat(beta) n{${N}} option n not allowed
    Any guidance on resolving this issue would be greatly appreciated.


    Code:
    
    ****bootstrap survey design SE*****
    *Step 1, save observed coefficients****
    preserve
    quietly xi:  arhomme log_avrg_cost i.inc_d i.endentulism i.race i.age_cat i.male i.education i.veteran i.mothered i.wealth i.smoke_now chronicdisease[pw=new_weight], select(r11dentst = dentalinsurance_w1 endentulism inc_d race age_cat male education veteran mothered wealth smoke_now chronicdisease) quantiles(0.10) taupoints(29) rhopoints(35)  meshsize(0.5) frank nostderrors  centergrid(-0.20)
    
    matrix beta = e(b)
    global N "`e(N)'"
    global Ns "`e(sN)'"
    restore
    
    ** step 2 generate program for bootstrap****
    capture program drop arhomme_bootstrap
    program arhomme_bootstrap, eclass  
    preserve
    bsample, strata(raestrat) cluster(raehsamp)
    
    quietly xi:  arhomme log_avrg_cost i.inc_d i.endentulism i.race i.age_cat i.male i.education i.veteran i.mothered i.wealth i.smoke_now chronicdisease[pw=new_weight], select(r11dentst = dentalinsurance_w1 endentulism inc_d race age_cat male education veteran mothered wealth smoke_now chronicdisease) quantiles(0.10) taupoints(29) rhopoints(35)  meshsize(0.5) frank nostderrors  centergrid(-0.20)
    
    matrix beta_boot = e(b)
    
    forvalue i = 1/35 {
        
        ereturn scalar beta_boot_`i' =beta_boot[1, `i']
    }
    
    
    **# Bookmark #1
    restore
    end
    
    * step 3: run the bootstrap**
    
    
    simulate b_r11dentst_dental_insurance = beta_boot[1,1] b_r11dentst_endentulism = beta_boot[1,2] b_r11dentst_inc_d = beta_boot[1,3] b_r11dentst_race = beta_boot[1,4] b_r11dentst_age_cat = beta_boot[1,5] ///
    b_r11dentst_male = beta_boot[1,6] b_r11dentst_education = beta_boot[1,7] b_r11dentst_veteran = beta_boot[1,8] b_r11dentst_mothered = beta_boot[1,9] b_r11dentst_wealth = beta_boot[1,10] ///
    b_r11dentst_smoke_now = beta_boot[1,11] b_r11dentst_chronicdisease = beta_boot[1,12] b_r11dentst_cons = beta_boot[1,13] b_q10_cons = beta_boot[1,14] b_q10_inc_d = beta_boot[1,15] b_q10_endentulism = beta_boot[1,16] ///
    b_q10_race_2 = beta_boot[1,17] b_q10_race_3 = beta_boot[1,18] b_q10_race_4 = beta_boot[1,19] b_q10_age_cat_2 = beta_boot[1,20] b_q10_age_cat_3 = beta_boot[1,21] b_q10_age_cat_4 = beta_boot[1,22] ///
    b_q10_male = beta_boot[1,23] b_q10_education_2 = beta_boot[1,24] b_q10_education_3 = beta_boot[1,25] b_q10_education_4 = beta_boot[1,26] b_q10_education_5 = beta_boot[1,27] b_q10_veteran = beta_boot[1,28] ///
    b_q10_mothered = beta_boot[1,29] b_q10_wealth_2 = beta_boot[1,30] b_q10_wealth_3 = beta_boot[1,31] b_q10_wealth_4 = beta_boot[1,32] b_q10_smoke_now = beta_boot[1,33] b_q10_chronicdisease = beta_boot[1,34] ///
    b_anc_rho = beta_boot[1,35], ///
    reps(2) seed(123456): arhomme_bootstrap
    
    * step 4 estimate the boostrap SE**
    preserve
    bstat, stat(beta) n(${sN})
    restore
    
    Bootstrap results                                             Replications = 2
    
    ----------------------------------------------------------------------------------------------
                                 |   Observed   Bootstrap                         Normal-based
                                 | coefficient  std. err.      z    P>|z|     [95% conf. interval]
    -----------------------------+----------------------------------------------------------------
    r11dentst                    |
    b_r11dentst_dental_insurance |    .523821   .0149489    35.04   0.000     .4945217    .5531203
         b_r11dentst_endentulism |  -.9923927   .0108306   -91.63   0.000     -1.01362    -.971165
               b_r11dentst_inc_d |  -.1491908   .0453383    -3.29   0.001    -.2380522   -.0603294
                b_r11dentst_race |    -.08872   .0003113  -285.04   0.000    -.0893301     -.08811
             b_r11dentst_age_cat |     .08599   .0012628    68.10   0.000      .083515     .088465
                b_r11dentst_male |  -.2599675     .01408   -18.46   0.000    -.2875639   -.2323711
           b_r11dentst_education |   .1695978   .0043624    38.88   0.000     .1610477    .1781479
             b_r11dentst_veteran |   .0551342   .0209855     2.63   0.009     .0140035     .096265
            b_r11dentst_mothered |   .0268983   .0178833     1.50   0.133    -.0081524    .0619489
              b_r11dentst_wealth |   .3405195   .0122915    27.70   0.000     .3164285    .3646104
           b_r11dentst_smoke_now |  -.2529702   .0224962   -11.25   0.000    -.2970619   -.2088786
      b_r11dentst_chronicdisease |  -.0131275   .0062461    -2.10   0.036    -.0253697   -.0008854
                b_r11dentst_cons |  -1.068637   .0612556   -17.45   0.000    -1.188696   -.9485786
    -----------------------------+----------------------------------------------------------------
    .1_quantile                  |
                      b_q10_cons |   1.862657   .4849658     3.84   0.000     .9121417    2.813173
                     b_q10_inc_d |  -.1892664    .206257    -0.92   0.359    -.5935228    .2149899
               b_q10_endentulism |  -.8884163   .0183617   -48.38   0.000    -.9244046   -.8524279
                    b_q10_race_2 |  -.3892348   .2454278    -1.59   0.113    -.8702643    .0917948
                    b_q10_race_3 |  -.0540006   .2649967    -0.20   0.839    -.5733846    .4653833
                    b_q10_race_4 |  -.5208147   .0819425    -6.36   0.000    -.6814189   -.3602104
                 b_q10_age_cat_2 |   .2948959   .1437055     2.05   0.040     .0132383    .5765535
                 b_q10_age_cat_3 |   .7219095    .049809    14.49   0.000     .6242856    .8195334
                 b_q10_age_cat_4 |   .6959584   .0175763    39.60   0.000     .6615094    .7304074
                      b_q10_male |  -.3594654   .0454797    -7.90   0.000    -.4486039   -.2703268
               b_q10_education_2 |   .3748066   .4328375     0.87   0.387    -.4735393    1.223153
               b_q10_education_3 |   .7279758   .4908594     1.48   0.138     -.234091    1.690043
               b_q10_education_4 |   .9618373    .432749     2.22   0.026     .1136648     1.81001
               b_q10_education_5 |   1.219666   .4589004     2.66   0.008     .3202383    2.119095
                   b_q10_veteran |   .1031842   .0408082     2.53   0.011     .0232016    .1831668
                  b_q10_mothered |  -.0244031   .0041735    -5.85   0.000    -.0325829   -.0162232
                  b_q10_wealth_2 |   .5151052   .2581096     2.00   0.046     .0092197    1.020991
                  b_q10_wealth_3 |   .8368382   .0887208     9.43   0.000     .6629487    1.010728
                  b_q10_wealth_4 |   1.056053    .021892    48.24   0.000     1.013145     1.09896
                 b_q10_smoke_now |  -.1627762   .1467932    -1.11   0.267    -.4504856    .1249331
            b_q10_chronicdisease |   .0370667   .0117938     3.14   0.002     .0139512    .0601822
    -----------------------------+----------------------------------------------------------------
    _anc                         |
                       b_anc_rho |  -5.915026          .        .       .            .           .
    ----------------------------------------------------------------------------------------------
Working...
X