Announcement

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

  • error when using bsample with weights

    Hello, I am trying to manually implement the survey design to compute standard errors using the arhomme command since svyset is not compatible with it. I am using bsample with the options strata(raestrat) cluster(raehsamp) weight(new_weight), but when I include the weight() option, I receive the error: "estimates post: matrix has missing values." Any advice on how to properly implement the weights would be greatly appreciated. My code is listed below.



    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, 0.25, 0.50, 0.75, 0.90)  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) weight(new_weight)
    
    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, 0.25, 0.50, 0.75, 0.90)  taupoints(29) rhopoints(35)  meshsize(0.5) frank nostderrors  centergrid(-0.20)
    
    matrix beta_boot = e(b)
    
    forvalue i = 1/119 {
        
        ereturn scalar beta_boot_`i' =beta_boot[1, `i']
    }
    
    
    restore
    end  
    
    estimates post: matrix has missing values
    r(504);
Working...
X