Announcement

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

  • bootstrap command :insufficient observations to compute bootstrap standard errors

    Dear Statalisters,

    I am trying to estimate the impact of wage on a binary variable, using cross-sectional data. Since the wage is likely to be endogeneous, I found an instrument for it and I implement the following two steps control function approach, which uses the estimates of the first stage regression error terms as control variables in the second stage regression:

    1/ First stage (tobit) regression: wage = instrument + control variable
    I then compute the residuals of this regression

    2/ 2nd stage (probit) regression: DV= wage + residuals + control variables

    I implemented a very simple program on STATA to get the std errors right but when I run it I get the following error message: "insufficient observations to compute bootstrap standard errors no results will be saved", although I added the nodrop option, as suggested in the following post https://www.statalist.org/forums/for...s-will-be-save.

    Here is my code:

    Code:
    cap program drop myprog
    program define myprog
    tobit log_income instrument age age_2 education ethnicity religion if education==1, cluster (city) ll(0)
    predict xb if e(sample), xb
    gen residual = log_income - xb if e(sample)
    probit DV log_income residual age age_2 education ethnicity religion if education==1, cluster (city)
    drop residual
    end
    bootstrap, r(100) nodrop: myprog

    I get the same error message when I delete the "e(sample)", the "if" or the cluster statements from the code. I've got around 5000 observations. Would have any suggestion to make the boostrapping of my program work?

    Best,
    Anna

  • #2
    Change the drop statement to:
    Code:
    drop xb residual
    The second time that bootstrap runs the program, it silently fails at the predict statement, because xb already exists. Another approach is create (via generate or predict) only temporary variables.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Thank you very much Steve, changing the drop statement solved my problem.
      Best,
      Anna

      Comment

      Working...
      X