Announcement

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

  • Reporting Adjusted R2 on Stata

    Hello Everyone! I am new to STATA and I am having trouble reporting the Adjusted R2

    When I run a regression with fixed effects and clustered standard errors, only the R2 is reported... Is there a way to include the adjusted R2 as well??
    Thank you!

  • #2
    Paul:
    yes, you can recall it after -regress-:
    Code:
    use "https://www.stata-press.com/data/r16/nlswork.dta"
    . reg ln_wage c.age##c.age i.idcode i.year if idcode<=4, vce(cluster idcode)
    
    Linear regression                               Number of obs     =         50
                                                    F(2, 3)           =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.6590
                                                    Root MSE          =     .28764
    
                                     (Std. Err. adjusted for 4 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .2364322   .2603253     0.91   0.431     -.592039    1.064903
                 |
     c.age#c.age |  -.0056102   .0021351    -2.63   0.078    -.0124052    .0011848
                 |
          idcode |
              2  |   -.394374   .0296125   -13.32   0.001    -.4886143   -.3001337
              3  |   .1010589   1.385597     0.07   0.946     -4.30853    4.510648
              4  |   .5522662   1.411066     0.39   0.722    -3.938377    5.042909
                 |
            year |
             69  |    .224994   .2362011     0.95   0.411    -.5267035    .9766914
             70  |   .1649135   .4084011     0.40   0.713    -1.134801    1.464628
             71  |   .1712431   .5615442     0.30   0.780    -1.615841    1.958327
             72  |   .3136266   .8258606     0.38   0.729     -2.31463    2.941883
             73  |   .4386164   1.160727     0.38   0.731    -3.255333    4.132566
             75  |    .575746   1.642352     0.35   0.749     -4.65095    5.802442
             77  |    .651904   2.091338     0.31   0.776    -6.003666    7.307474
             78  |   .9314592   2.431102     0.38   0.727    -6.805391     8.66831
             80  |   .9700889   3.035563     0.32   0.770    -8.690428    10.63061
             82  |   1.063147   3.462289     0.31   0.779    -9.955403     12.0817
             83  |   1.379563   3.652919     0.38   0.731    -10.24566    13.00478
             85  |   1.854813   3.994786     0.46   0.674    -10.85838      14.568
             87  |   2.153058   4.439545     0.48   0.661    -11.97556    16.28167
             88  |   2.571633   4.744555     0.54   0.625    -12.52766    17.67092
                 |
           _cons |  -1.093667   4.089099    -0.27   0.806    -14.10701    11.91967
    ------------------------------------------------------------------------------
    
    . di e(r2_a)
    .44310999
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Paul:
      yes, you can recall it after -regress-:
      Code:
      use "https://www.stata-press.com/data/r16/nlswork.dta"
      . reg ln_wage c.age##c.age i.idcode i.year if idcode<=4, vce(cluster idcode)
      
      Linear regression Number of obs = 50
      F(2, 3) = .
      Prob > F = .
      R-squared = 0.6590
      Root MSE = .28764
      
      (Std. Err. adjusted for 4 clusters in idcode)
      ------------------------------------------------------------------------------
      | Robust
      ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      age | .2364322 .2603253 0.91 0.431 -.592039 1.064903
      |
      c.age#c.age | -.0056102 .0021351 -2.63 0.078 -.0124052 .0011848
      |
      idcode |
      2 | -.394374 .0296125 -13.32 0.001 -.4886143 -.3001337
      3 | .1010589 1.385597 0.07 0.946 -4.30853 4.510648
      4 | .5522662 1.411066 0.39 0.722 -3.938377 5.042909
      |
      year |
      69 | .224994 .2362011 0.95 0.411 -.5267035 .9766914
      70 | .1649135 .4084011 0.40 0.713 -1.134801 1.464628
      71 | .1712431 .5615442 0.30 0.780 -1.615841 1.958327
      72 | .3136266 .8258606 0.38 0.729 -2.31463 2.941883
      73 | .4386164 1.160727 0.38 0.731 -3.255333 4.132566
      75 | .575746 1.642352 0.35 0.749 -4.65095 5.802442
      77 | .651904 2.091338 0.31 0.776 -6.003666 7.307474
      78 | .9314592 2.431102 0.38 0.727 -6.805391 8.66831
      80 | .9700889 3.035563 0.32 0.770 -8.690428 10.63061
      82 | 1.063147 3.462289 0.31 0.779 -9.955403 12.0817
      83 | 1.379563 3.652919 0.38 0.731 -10.24566 13.00478
      85 | 1.854813 3.994786 0.46 0.674 -10.85838 14.568
      87 | 2.153058 4.439545 0.48 0.661 -11.97556 16.28167
      88 | 2.571633 4.744555 0.54 0.625 -12.52766 17.67092
      |
      _cons | -1.093667 4.089099 -0.27 0.806 -14.10701 11.91967
      ------------------------------------------------------------------------------
      
      . di e(r2_a)
      .44310999
      
      .
      Thank you so much for your reply Carlo!!

      May I ask one more question please??? I see that you typed c.age##c.age on the example regression above. Is there a difference between using one # or using two ## ??

      Comment


      • #4
        Paul:
        yes, there is.
        Single #: interaction only.
        Double #: interaction + conditional main effect of the interacted terms (if they differ).
        Double #: linear + square term of the same predictor (this is the case of my previous example).
        See -fvvarlist- for further details.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X