Announcement

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

  • R2 with xtdidregress

    Dear Statalist,

    I have searched previous posts but I cannot find anything regarding this problem. When I run xtdidregress, no R2 is generated in the output table. When I look under "ereturn list" there is no e(r2) or e(r2_a), which guides have referred to for other commands (eg "regress). Please could somebody help me to calculate the R2 and adjusted R2 from an xtdidregress regression?

    Thank you for your help.
    Last edited by Sandra Smith; 04 May 2022, 13:21.

  • #2
    You can always replicate the xtdidregress estimation with regress or xtreg.

    Code:
    xtset id year
    xtdidregress (y z1 z2) (d), group(id) time(year)
    is equivalent to

    Code:
    regress y z1 z2 i.id i.year d, vce(cluster id)
    *OLS R2 
    di e(r2)
    or

    Code:
    xtset id year
    xtreg y z1 z2 i.year d, fe robust
    *WITHIN R2 
    di e(r2_w)

    Comment


    • #3
      Thanks for your help Andrew, the first solution works for me.

      Comment

      Working...
      X