Hello,

I am trying to calculate the arc elasticities for a low income group and a high income group. I am using bootstrap replication but I am getting crazy high SE.
Am I doing it wrong? I think it is also possible to get the elasticities using nlcom, but I have no idea how to? I have read the manual on nlcom.

I am trying to get the arc price elasticities for the effect of cost sharing in different insurance plans from the RAND experiment. The rand_plan_groupX are all dummies.

I am focusing on the results for the total annual medical spending: spending_infl.

here is the current code I am using for the elasticities:

Code:
program ArcElasticityHigh

    version 10.1
    syntax [varlist] [if] [in] [,*]
    
    tokenize `varlist'
    local lhsvar `1'
    macro shift 1
    local rhsvars "`*'"
    
    if replay() {
        _coef_table, `options'
        exit
    }
    
    _rmcollright `rhsvars', noconstant
    local rhs `r(varlist)'
    regress `lhsvar' `rhs' `if' `in', `options'
    tempname bb_regress
    matrix `bb_regress' = e(b)
    tempname bb 
    matrix `bb' = J(1,18,0)
    matrix `bb'[1,1] = (`bb_regress'[1,2] - `bb_regress'[1,1])/(`bb_regress'[1,2] + `bb_regress'[1,1])
    matrix `bb'[1,2] = (`bb_regress'[1,3] - `bb_regress'[1,1])/(`bb_regress'[1,3] + `bb_regress'[1,1])
    matrix `bb'[1,3] = (`bb_regress'[1,4] - `bb_regress'[1,1])/(`bb_regress'[1,4] + `bb_regress'[1,1])
    matrix `bb'[1,4] = (`bb_regress'[1,5] - `bb_regress'[1,1])/(`bb_regress'[1,5] + `bb_regress'[1,1])
    matrix `bb'[1,5] = (`bb_regress'[1,6] - `bb_regress'[1,1])/(`bb_regress'[1,6] + `bb_regress'[1,1])
    matrix `bb'[1,6] = ((`bb_regress'[1,3] - `bb_regress'[1,2])/(`bb_regress'[1,3] + `bb_regress'[1,2]))/((31.897 - 25)/(31.897 + 25))
    matrix `bb'[1,7] = ((`bb_regress'[1,4] - `bb_regress'[1,2])/(`bb_regress'[1,4] + `bb_regress'[1,2]))/((50-25)/(50 + 25))
    matrix `bb'[1,8] = ((`bb_regress'[1,5] - `bb_regress'[1,2])/(`bb_regress'[1,5] + `bb_regress'[1,2]))/((95-25)/(95 + 25))
    matrix `bb'[1,9] = ((`bb_regress'[1,6] - `bb_regress'[1,2])/(`bb_regress'[1,6] + `bb_regress'[1,2]))/((57.67825-25)/(57.67825 + 25))
    matrix `bb'[1,10] = ((`bb_regress'[1,4] - `bb_regress'[1,3])/(`bb_regress'[1,4] + `bb_regress'[1,3]))/((50-31.897)/(50 + 31.897))
    matrix `bb'[1,11] = ((`bb_regress'[1,5] - `bb_regress'[1,3])/(`bb_regress'[1,5] + `bb_regress'[1,3]))/((95-31.897)/(95 + 31.897))
    matrix `bb'[1,12] = ((`bb_regress'[1,6] - `bb_regress'[1,3])/(`bb_regress'[1,4] + `bb_regress'[1,3]))/((57.67825-31.897)/(57.67825 + 31.897))
    matrix `bb'[1,13] = ((`bb_regress'[1,5] - `bb_regress'[1,4])/(`bb_regress'[1,5] + `bb_regress'[1,4]))/((95-50)/(95 + 50))
    matrix `bb'[1,14] = ((`bb_regress'[1,6] - `bb_regress'[1,4])/(`bb_regress'[1,6] + `bb_regress'[1,4]))/((57.67825-50)/(57.6825 + 50))
    matrix `bb'[1,15] = ((`bb_regress'[1,6] - `bb_regress'[1,5])/(`bb_regress'[1,6] + `bb_regress'[1,5]))/((57.67825-95)/(57.6825 + 95))
    
    
    matrix `bb'[1,16] = (3529*`bb'[1,1] + 2993*`bb'[1,2] + 3143*`bb'[1,3] + 4020*`bb'[1,4] + 3932*`bb'[1,5] + 1568*`bb'[1,6] + 1718*`bb'[1,7] + 2595*`bb'[1,8] + 2507*`bb'[1,9] + 1181*`bb'[1,10] + 2058*`bb'[1,11] + 1970*`bb'[1,12] + 2209*`bb'[1,13] + 2121*`bb'[1,14] + 2998*`bb'[1,15])/38542
    
    matrix `bb'[1,17] = (1568*`bb'[1,6] + 1718*`bb'[1,7] + 2595*`bb'[1,8] + 2507*`bb'[1,9] + 1181*`bb'[1,10] + 2058*`bb'[1,11] + 1970*`bb'[1,12] + 2209*`bb'[1,13] + 2121*`bb'[1,14] + 2998*`bb'[1,15])/20925
    
    matrix `bb'[1,18] = (1568*`bb'[1,6] + 1718*`bb'[1,7] + 2595*`bb'[1,8] + 1181*`bb'[1,10] + 2058*`bb'[1,11] + 2209*`bb'[1,13])/11329
    
    
    matrix colnames `bb' = 25vFC MixedvFC 50vFC 95vFC IDvFC 25vMixed 25v50 25v95 25vID Mixedv50 Mixedv95 MixedvID 50v95 50vID 95vID AllPlansAvr NotFC NotFCID
    
    tempvar mySamp
    gen `mySamp' = e(sample)
    ereturn post `bb', esample(`mySamp')
    
end
    
    
    cd "/Users/lisabrenz/Desktop/RAND_HIE_TDL_data/AnalysisData"
    use"high_incomegroup_2.dta"
    
seet seed 620549

log using /Users/lisabrenz/Desktop/RAND_HIE_TDL_data/TableArcElast_Highincome1.log, replace
    
    local vars "spending inp out"
    foreach var of local vars {
    local controls age baseline_fam_size    
    
    quietly ArcElasticityHigh `var'_infl rand_plan_group1 rand_plan_group2 rand_plan_group3 rand_plan_group4 rand_plan_group5 rand_plan_group6 `controls' demeaned_fam_start_month_site* demeaned_cal_year*, nocons
    bs, cluster(ifamily) reps(500):  ArcElasticityHigh `var'_infl rand_plan_group1 rand_plan_group2 rand_plan_group3 rand_plan_group4 rand_plan_group5 rand_plan_group6 `controls' demeaned_fam_start_month_site* demeaned_cal_year*, nocons
}

capture log close
clear


And I get the following results for the elasticities of spending_infl:

Code:
Bootstrap results                               Number of obs     =      7,542
                                                Replications      =        500

                             (Replications based on 1,061 clusters in ifamily)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       25vFC |   -.396818   .3512734    -1.13   0.259    -1.085301    .2916653
    MixedvFC |  -.2921649   .3247836    -0.90   0.368     -.928729    .3443992
       50vFC |  -.7415102   2.305057    -0.32   0.748     -5.25934    3.776319
       95vFC |  -.8324506   1.524617    -0.55   0.585    -3.820644    2.155743
       IDvFC |  -.1460065    .164682    -0.89   0.375    -.4687772    .1767642
    25vMixed |   .9765572   24.74259     0.04   0.969    -47.51803    49.47115
       25v50 |  -1.465206     11.851    -0.12   0.902    -24.69274    21.76233
       25v95 |  -1.115177   13.42692    -0.08   0.934    -27.43146    25.20111
       25vID |   .6735974   215.0348     0.00   0.998    -420.7868     422.134
    Mixedv50 |  -2.595004   125.3938    -0.02   0.983    -248.3624    243.1724
    Mixedv95 |  -1.435658   36.67244    -0.04   0.969    -73.31233    70.44101
    MixedvID |   .9851153   25.85431     0.04   0.970     -49.6884    51.65863
       50v95 |  -.7656327   10.26238    -0.07   0.941    -20.87953    19.34826
       50vID |   9.365516   202.6918     0.05   0.963    -387.9031    406.6341
       95vID |  -3.196775   25.04948    -0.13   0.898    -52.29285    45.89931
 AllPlansAvr |  -.1610361   19.12084    -0.01   0.993     -37.6372    37.31513
       NotFC |   .1108378   35.19378     0.00   0.997     -68.8677    69.08937
     NotFCID |  -1.023076   16.66974    -0.06   0.951    -33.69516    31.64901
------------------------------------------------------------------------------
Hope someone can help me! Thank you!