Announcement

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

  • Help with bootstrap.

    Dear All,
    I posted earlier but made it more complicated than necessary and did not get any response. So, trying again.

    I want to bootstrap my standard errors for a two step estimation procedure but am getting an error message. Here is the dataex for my data:

    Code:
     
     * Example generated by -dataex-. For more info, type help dataex clear input float grpatidtreat byte(Female age80plus Asian Black Hispanic) float COVID double PopDensity float tavg double prcp byte(_st _d _t _t0) 15206 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  3004 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 17435 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2112 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 26240 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19463 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20156 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1578 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20172 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19990 0 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24292 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22231 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 1 1 0  3816 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1326 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 25147 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24294 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  6048 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20208 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 12468 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24929 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 18131 0 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  8075 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 18614 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1100 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20014 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20349 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 15241 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  8237 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   347 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   532 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20100 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7709 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21965 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   245 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 12819 0 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 26574 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22608 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20670 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 10468 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2431 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22729 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19918 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  6767 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2013 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 13247 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   409 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24019 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  8130 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1503 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   450 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 25712 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21945 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7870 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19688 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22838 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 26055 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  6305 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2688 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7771 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21690 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24805 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22742 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  5887 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 14911 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 10076 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19660 1 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 23040 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1188 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 18448 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7966 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2058 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   693 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0   338 0 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1245 0 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 25259 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22337 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21719 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21801 0 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19906 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  2593 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 10784 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7057 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22519 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 1 1 0 22109 0 0 0 0 1 0 99.2 26.89387 102.04999969899654 1 0 1 0  1508 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24739 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19928 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22893 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 19535 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 22551 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 10009 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  1990 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 14715 1 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  8545 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24844 0 0 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20016 1 1 0 0 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 21723 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 20133 0 1 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0  7299 1 0 0 1 0 0 99.2 26.89387 102.04999969899654 1 0 1 0 24604 0 0 0 0 1 0 99.2 26.89387 102.04999969899654 1 0 1 0 end label values COVID COVID label def COVID 0 "No confirmed COVID-19", modify
    I want to run a 2-step estimation, which runs smoothly without bootstrapping for standard errors:

    Code:
     
     . probit COVID Female age80plus Asian Black Hispanic PopDensity tavg prcp if sample==1  Iteration 0:  Log likelihood = -84773.888   Iteration 1:  Log likelihood = -84145.633   Iteration 2:  Log likelihood = -84139.719   Iteration 3:  Log likelihood = -84139.718    Probit regression                                      Number of obs = 697,196                                                        LR chi2(8)    = 1268.34                                                        Prob > chi2   =  0.0000 Log likelihood = -84139.718                            Pseudo R2     =  0.0075  ------------------------------------------------------------------------------        COVID | Coefficient  Std. err.      z    P>|z|     [95% conf. interval] -------------+----------------------------------------------------------------       Female |    .024962    .006397     3.90   0.000      .012424       .0375    age80plus |  -.1059373   .0076874   -13.78   0.000    -.1210044   -.0908702        Asian |   .0091485   .0177039     0.52   0.605    -.0255504    .0438474        Black |   .0673043   .0105328     6.39   0.000     .0466603    .0879483     Hispanic |   .2271459   .0092874    24.46   0.000     .2089429     .245349   PopDensity |   .0001692   .0000121    14.04   0.000     .0001455    .0001928         tavg |  -.0063606   .0003474   -18.31   0.000    -.0070415   -.0056797         prcp |   .0001733   .0000623     2.78   0.005     .0000512    .0002954        _cons |  -1.933265   .0082191  -235.22   0.000    -1.949374   -1.917156 ------------------------------------------------------------------------------  . . //margins, dydx(*) . predict xd2h, index  . gen phi2h = normalden(xd2h)  . gen PHI2h = normal(xd2h)  . gen gr2 = COVID*phi2h/PHI2h - (1 - COVID)*phi2h/(1 - PHI2h)  . gen COVID_gr2 = COVID*gr2  . . . foreach v in Female age80plus Asian Black Hispanic {   2.         sum `v'   3.         gen `v'm=`v'-r(mean)   4.         gen COVID_`v'm=COVID*`v'm   5.         gen COVID`v'gr2=COVID_`v'm*gr2   6. }      Variable |        Obs        Mean    Std. dev.       Min        Max -------------+---------------------------------------------------------       Female |    697,605    .5619885    .4961429          0          1      Variable |        Obs        Mean    Std. dev.       Min        Max -------------+---------------------------------------------------------    age80plus |    697,605    .2472932    .4314389          0          1      Variable |        Obs        Mean    Std. dev.       Min        Max -------------+---------------------------------------------------------        Asian |    697,605    .0342801     .181948          0          1      Variable |        Obs        Mean    Std. dev.       Min        Max -------------+---------------------------------------------------------        Black |    697,605    .0990632    .2987471          0          1      Variable |        Obs        Mean    Std. dev.       Min        Max -------------+---------------------------------------------------------     Hispanic |    697,605    .1089069    .3115226          0          1  . . ***Second Stage*** . eststo: stcrreg Female age80plus Asian Black Hispanic COVID gr2 if sample==1, compete(d2=2)           Failure _d: d2==1    Analysis time _t: stop   Enter on or after: time start         ID variable: grpatidtreat  Iteration 0:  Log pseudolikelihood = -37079.611   Iteration 1:  Log pseudolikelihood = -37077.898   Iteration 2:  Log pseudolikelihood = -37077.897    Competing-risks regression                        No. of obs      =    697,196                                                   No. of subjects =     25,644 Failure event:   d2 == 1                          No. failed      =      3,737 Competing event: d2 == 2                          No. competing   =      2,261                                                   No. censored    =     19,646                                                    Wald chi2(7)    =    1227.46 Log pseudolikelihood = -37077.897                 Prob > chi2     =     0.0000                        (Std. err. adjusted for 25,644 clusters in grpatidtreat) ------------------------------------------------------------------------------              |               Robust           _t |        SHR   std. err.      z    P>|z|     [95% conf. interval] -------------+----------------------------------------------------------------       Female |   1.095094   .0366405     2.71   0.007     1.025584    1.169315    age80plus |    3.00898   .1062511    31.20   0.000     2.807775    3.224604        Asian |   .9216742   .0904136    -0.83   0.406     .7604611    1.117063        Black |   1.128179   .0618504     2.20   0.028      1.01324    1.256156     Hispanic |   1.237449   .0724726     3.64   0.000     1.103255    1.387966        COVID |   .0949024   .1989416    -1.12   0.261     .0015593    5.776043          gr2 |   3.251186   2.834039     1.35   0.176     .5889177    17.94854 ------------------------------------------------------------------------------ (est47 stored)  . estimates store ProbitCF
    I clearly have a relatively large sample size, but, when I bootstrap standard errors to account for the two step estimation, I get the following error message:

    Code:
     
     . ***First Stage*** . probit COVID Female age80plus Asian Black Hispanic PopDensity tavg prcp if sa > mple==1   2. predict xd2h, index   3. gen phi2h = normalden(xd2h)   4. gen PHI2h = normal(xd2h)   5. gen gr2 = COVID*phi2h/PHI2h - (1 - COVID)*phi2h/(1 - PHI2h)   6. gen COVID_gr2 = COVID*gr2   7. . foreach v in Female age80plus Asian Black Hispanic {   8.         sum `v'   9.         gen `v'm=`v'-r(mean)  10.         gen COVID_`v'm=COVID*`v'm  11.         gen COVID`v'gr2=COVID_`v'm*gr2  12. }  13. . ***Second Stage*** . eststo: stcrreg Female age80plus Asian Black Hispanic COVID gr2 if sample==1, >  compete(d2=2) . end  . . bootstrap _b, reps(100) seed(123): boot (running boot on estimation sample)  Bootstrap replications (100): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx done x: Error occurred when bootstrap executed boot. insufficient observations to compute bootstrap standard errors no results will be saved r(2000);  end of do-file r(2000);

    What am I doing wrong here? Will be grateful for your input.
    Sincerely,
    Sumedha
Working...
X