Announcement

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

  • insufficient observations to compute bootstrap standard errors; no results will be saved


    Hi all, The following code sometimes works, and sometimes gives the attached error (the dataset may vary a little from time to time, but hard to believe they caused the error, and it's a large dataset). It's a bit puzzling as we have tried all the suggested things we found (nodrop option, rclass, drop generated variables). If anyone has any suggestion what may have gone wrong, please share! Thank you.

    set emptycells drop
    cap drop y_*
    bootstrap, reps(100) nodrop: two_step, depvar(az_ges) //az_ges is variable “no. of all employees”

    capture program drop two_step
    program define two_step, rclass
    syntax , * ///
    depvar(str) ///

    capture drop y_res
    capture drop y_d
    capture drop y_d_oos

    *Step 1.i
    reghdfe `depvar' if yrsince < 0, absorb(betnr) resid

    *Step 1.ii
    predict y_d, d

    *Step 1.iii
    bysort betnr (yrsince): egen y_d_oos = mean(y_d)

    *Step 1.iv
    gen y_res = `depvar' - y_d_oos

    *Step 2
    reg y_res _DTreatyrsince* _Dyrsince*

    end
    Attached Files
    Last edited by Linh To; 14 Oct 2022, 09:58.
Working...
X