Announcement

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

  • rdrobust table mean value

    Hello!

    I am having problem with exporting results from rdrobust.

    I export the regression results with outreg2, that works well. However, I want to add the mean value (for the outcome variable for each side of the cut-off) to the statistics below the regression estimates. I cannot see that rdrobust saves any means in e(). Is that correct? If so, is there another to add statistics to the table?

    My code:

    rdrobust outcome1 date, c(19571) p(1)
    outreg2 using "$tables/table1.tex", replace ///
    tex(fragment) nonote noobs ///
    addtext(Covariates, NO) ///
    addstat(Observations, e(N), Bandwidth, e(h_l), Order polyn., e(p))

    Thanks a lot for your help!

    Best,
    Louise

  • #2
    Try this:
    Code:
    rdrobust outcome1 date, c(19571) p(1)
    qui sum outcome1
    
    outreg2 using "$tables/table1.tex", replace ///
        tex(fragment) nonote noobs ///
        addtext(Covariates, NO) ///
        addstat(Mean dep. var., r(mean), Observations, e(N), Bandwidth, e(h_l), Order polyn., e(p))
    If you want it on both sides:
    Code:
    rdrobust outcome1 date, c(19571) p(1)
    qui sum outcome1 if date<19571
    local mean1=r(mean)
    qui sum outcome1 if date>=19571
    local mean2=r(mean)
    
    outreg2 using "$tables/table1.tex", replace ///
        tex(fragment) nonote noobs ///
        addtext(Covariates, NO) ///
        addstat(Mean left, `mean1', Mean right, `mean2', Observations, e(N), Bandwidth, e(h_l), Order polyn., e(p))
    Last edited by Salvatore Lattanzio; 21 Jan 2020, 15:33.

    Comment


    • #3
      That works great, thanks a lot! =D

      Comment

      Working...
      X