Announcement

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

  • Fixed effects models with instrumental variables and bootstrapped standard errors within clusters

    I'm trying to run some panel data, and the way the sampling occurred I should bootstrap the standard errors with resampling by cluster (as described in Harden 2011). I've done this successfully with xtreg (fixed effects) but I'm trying to incorporate instrumental variables and I'm getting some error messages.

    The data I have is protected, but I can simulate the problem with the nlswork dataset.

    Code:
    cls  
    webuse nlswork, clear  
    
    keep if year==77 | year==78  
    
    gen sampleclustervar=1 if idcode<2696
    replace sampleclustervar=2 if idcode>2696 & idcode<6000  
    
    xtset id year xtreg ln_wage age tenure hours union, fe vce(bootstrap, reps(1000))  cluster(sampleclustervar) // This line works fine
    xtivreg ln_wage age tenure hours (union= south), fe vce(bootstrap, reps(1000))  cluster(sampleclustervar) // This line does not work

    According to what I'm seeing in the help file, this should work, I think. But instead I get:

    Code:
    option cluster() not allowed
    an error occurred when bootstrap executed xtivreg
    And unfortunately it doesn't look like xtivreg2 supports it either, which is too bad because I really like the automatic tests that come with it. Does anyone have an idea of how to fix this? I'm using 15.1



    (Note: I apologize for posting this twice. I didn't post the right tags on this earlier and now I can't seem to delete my original or edit it to put the tags on. The original was here: https://www.statalist.org/forums/for...ors-by-cluster)

  • #2
    After some more intense googling, I came across this question: https://www.stata.com/statalist/arch.../msg01412.html
    And this reply: https://www.stata.com/statalist/arch.../msg01433.html

    So I have tried this:
    Code:
    cls  
    webuse nlswork, clear  
    
    keep if year==77 | year==78  
    
    gen sampleclustervar=1 if idcode<2695.5
    replace sampleclustervar=2 if idcode>2695.5 & idcode<6000  
    
    xtset id
    
    bootstrap, cluster(sampleclustervar) reps(50): xtivreg ln_wage age tenure hours (union= south), fe
    This appears to work. Is this equivalent to:

    Code:
     
     xtivreg ln_wage age tenure hours (union= south), fe vce(bootstrap, reps(50))  cluster(sampleclustervar)

    Comment

    Working...
    X