Announcement

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

  • Programing bootstrap standard errors

    Hi all,

    I am defending my PhD in one week, and I really need to solve the following issue. Any suggestion would be greatly appeciated.

    I am correcting the standard errors from a panel heckman model. Since there is no heckman command for panel data, I have to conduct it using two stage as follows,

    Code:
    cap program drop myboot
    program define myboot, rclass
    tempname b V
    tempvar a1
    capture drop Invmills_female linear_pred_female
    xtprobit rwork i.dummy_yearcancer age child18_ i.edu i.black i.hispanic wealth i.rhibpe i.rdiabe i.rlunge i.rhearte i.rstroke i.rpsyche rsmoke rdrink i.job i.spouseins earning  if (married==1 & ragender==2 & age <65), i(newid)vce(robust)
    predict linear_pred_female, xb
    gen Invmills_female = normalden(linear_pred_female)/normal(linear_pred)
    matrix `a1'=e(b)
    xtreg hours Invmills_female i.dummy_yearcancer age child18_ i.edu i.black i.hispanic wealth i.rhibpe i.rdiabe i.rlunge i.rhearte i.rstroke i.rpsyche rsmoke rdrink i.job i.spouseins earning  if (married==1 & ragender==2 & age <65 & selectvar==1),i(newid) vce(robust)
    matrix `b'=e(b)
    ereturn post `b'
    drop Invmills_female linear_pred_female
    end
    xtset,clear
    bootstrap _b _se, cluster(hhidpn) idcluster(newid) reps(50) nowarn: myboot if (married==1 & ragender==2 & age <65)
    I want to get the corrected standard errors. When I remove the _b _se, it works, but when I specify botstrap for standard errors it doesn't work. Why?

    Thank you so much.
    Last edited by Maryam Bidgoli; 20 Jul 2017, 10:12.

  • #2
    I don't do bootstrap, but I'm not clear why you'd need it. If all you want is bootstrap se's, why not use the bootstrap option in xtreg? Also, a minor point, why do you have
    linear_pred_female and linear_pred in the generate. You don't seem to create linear_pred. If you mean the same thing as linear_pred_female, you might want to use the full variable name. "It doesn't work" is not very helpful for diagnosis. I'd try putting set trace on before running the bootstrap and it may tell you where the thing is failing.

    Comment

    Working...
    X