Announcement

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

  • Wild cluster boostrap t- CGD(2008)

    Hi,

    I am asked to write Stata command reproduce the results of Wild Cluster Boostrap T as in " Cameron, A. Colin, Jonah G. Gelbach, and Douglas L. Miller. 2008. “Bootstrap-Based Improvements for Inference with Clustered Errors.” Review of Economics and Statistics. 90(3): 414-427 (CGD, 2008).

    I followed the procedure, yet the results are not the same. I really do not understand where my code goes wrong. I have found this paper from the author with the Stata command, cross-check my own code but still do not know why. http://cameron.econ.ucdavis.edu/rese...5_February.pdf

    Could any help me to detect when went wrong?

    Here is my code:

    Code:
     
    clear
    set seed 1234
    scalar beta0=0
    scalar beta1=1
    scalar groupsize=5
    set obs `=scalar(groupsize)'
    qui gen y=.
    qui gen yig=.
    qui gen yig_star=.
    qui gen zg=.
    qui gen eg=.
    qui gen zig=.
    qui gen eig=.
    qui gen xig=.
    qui gen uig=.
    qui gen groupid=_n
    qui gen clus_prob=.
    expand 30
    
    local count3=0
    
    *Generating data
        qui bysort groupid: replace zg=rnormal(0,1)
        qui bysort groupid: replace zg = zg[1]
        qui bysort groupid: replace eg=rnormal(0,1)
        qui bysort groupid: replace eg = eg[1]
        qui replace zig=rnormal(0,1)
        qui replace eig=rnormal(0,1)
        qui replace xig=zg+zig
        qui replace uig=eg+eig
        qui replace y=scalar(beta0)+scalar(beta1)*xig+uig
      
    *Wild cluster boostrap t
        scalar num_rep2=100
        
        forvalues i=1/`=scalar(num_rep2)'{
        qui regress y xig, cluster (groupid)
        local w=abs((_b[xig]-scalar(beta1))/_se[xig])
        * Impose the null
        qui replace yig=y-scalar(beta1)*xig
        qui regress yig
        qui predict xb // null imposed
        qui predict re, resid
        * Randomly assign probability of uig at cluster level
        qui bysort groupid: replace clus_prob=cond(runiform()<0.5, 1, -1) if _n==1
        qui bysort groupid: replace clus_prob=clus_prob[1]
        qui replace yig_star=xb+ scalar(beta1)*xig + re*clus_prob //Estimate manipulated data
        qui regress yig_star xig, cluster (groupid)
        local w_star=abs((_b[xig]-scalar(beta1))/_se[xig])
        local count3=`count3'+(`w_star'>`w')
        drop re xb
          }
    di `w'    
    scalar p1=`count1'/scalar(num_rep)
    display scalar(p1)
    
    scalar p2=`count2'/scalar(num_rep)
    display scalar(p2)
    
    scalar p3=`count3'/scalar(num_rep2)
    di scalar(p3)
    My result is about 0.3, but it is around 0.05 in the paper.

    Thank you so much.

    Lanna

  • #2
    What you are asking is pretty grand -- you have an idea for a nice replication of a paper, and your replication does not replicate the original, why is that... It is hard to tell you why, short of doing the replication instead of you, and then explaining the triple replication result differences between original, your version, and the version of whoever endeavours this.

    There is a powerful user contributed command that does wild bootstrap automatically, -boottest- by David Roodman. It will not do the replication instead of you, but at least you will have a third point of comparison for your, and authors' results.

    Comment


    • #3
      Thank Sir Kolev.

      The method is praised for better performance than classic regression with cluster option, and the paper is cited 3000 times according to Google Scholar. However, I have tried either my own code and the -boottest- package by Sir Roodman, yet it does not seem like that. Also the results seem to be unstable when I change group size parameter.

      That's how my confusion comes up.

      Comment

      Working...
      X