Announcement

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

  • Coefplot with boottest confidence intervals - multiple independent variables

    Dear Statalisters,

    I am trying to estimate the effect of 30 leaders on workers' outcomes as follows
    Code:
          for num 1/30: gen leaderP = (leaderID == P)
         reg worker_outcome leader* X1 X2 X3, noconstant cluster(leaderID)
    (where X1 and X3 are continuous, X2 is a category variable)
    I want to wild-bootstrap the effects of 30 dummies for 30 leaders using boottest. And I want to coefplot only the effects of 30 dummies with the bootstrapped CIs in one graph. But I have trouble doing this.

    I am using the suggestion from this post (https://www.statalist.org/forums/for...ence-intervals) with some adjustment, but it does not work.
    Code:
      reg worker_outcome leader* X1 X2 X3, noconstant cluster(leaderID)
    local leaderlist : colfullnames e(b)
    display "`leaderlist'"
    
    cap mat drop b 
    cap mat drop CI 
    
    local i 1
    foreach v of local leaderlist {  
        boottest `v', nograph  
        if "`r(b)'" != "" { 
            mat b = nullmat(b), r(b)'  
            mat CI = nullmat(CI), r(CI)'  
        }
        local ++i
    }
    
    mat colnames b = `leaderlist'
    mat colnames CI = `leaderlist'
    
    coefplot mat(b), ci(CI)
    I would appreciate any advice on this.


Working...
X