Announcement

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

  • Problems with esttab

    Greetings Everyone!

    Hopefully, you all will be fine, I am using eststo for my regression analysis in which there are 8 regressions in one table, after all the regressions (ols & random effect) and applying this
    HTML Code:
    esttab, stats(N N_g r2 r2_a, labels(Observations "Groups (Firms)" R-squared "Adj. R-squared"))
    the following results appear
    HTML Code:
    Observations         1526            1526            1526            1526            1582            1582            1582            1582   
    Groups (Fi~)                                          244             244                                             259             259   
    R-squared           0.217           0.217                                           0.152           0.152                                   
    Adj. R-squ~d        0.191           0.191                                           0.124           0.124                                   
    --------------------------------------------------------------------------------------------------------------------------
    in which some observations display while other not, what will be the solution for this.
    I need your help in this regard

    Yours Sincerely
    Sattar Khan

  • #2
    Can you show all commands you use? Maybe some regression types do not provide the statistic of interest?
    Best wishes

    (Stata 16.1 MP)

    Comment


    • #3
      Originally posted by Felix Bittmann View Post
      Can you show all commands you use? Maybe some regression types do not provide the statistic of interest?
      Dear Felix, i have used random effect and ols regression

      Comment


      • #4
        My guess is that the RE model stats are missing since they are stored in a different scalar so esttab does not find them under the normal name. I am not an expert with esttab, maybe someone can help out what to do here. If these are just a few numbers simply adding them manually might be quicker.
        Best wishes

        (Stata 16.1 MP)

        Comment


        • #5
          you might want to check out estadd,
          Code:
          clear all
          use http://www.stata-press.com/data/r16/nlswork.dta
          
          eststo ols: reg ln_wage hours
          egen tag = tag(idcode) if e(sample)
          count if tag
          estadd scalar firms = r(N)
          estadd scalar rsq = e(r2)
          
          eststo re: xtreg ln_wage hours if age, re i(idcode)
          estadd scalar firms = e(N_g)
          estadd scalar rsq = e(r2_o)
          
          esttab, stats(N firms rsq r2_a, labels(Observations "Groups (Firms)" R-squared "Adj. R-squared"))
          Last edited by Øyvind Snilsberg; 07 Jan 2022, 05:51.

          Comment


          • #6
            The R-squared statistic from regress is unambiguous, and is the model sum of squares divided by the total sum of squares from that regression. This is not the case for xtreg where you have 3 different R-squared statistics (between, within and overall). None of these is directly comparable to the statistic from regress, so wanting to display each of these on the same table and give them the same name is problematic. Doing it in esttab (from SSC, as you are asked to explain in FAQ Advice #12) is not difficult, but if you do so, add a note at the foot of the table alerting the reader not to do a straight comparison. You can find the definition of the xtreg R2-statistics from the manual entry of xtreg https://www.stata.com/manuals13/xtxtreg.pdf. Assuming that you want the overall R-squared statistic from xtreg (a similar logic applies to the others):

            Code:
            webuse grunfeld, clear
            eststo m1: regress invest mvalue kstock
            eststo m2: xtreg invest mvalue kstock
            estadd scalar r2= e(r2_o)
            esttab m1 m2, scalars(N r2) note("Some explanation of the xtreg R2 statistic") mlab(OLS RE)
            Res.:

            Code:
            . esttab m1 m2, scalars(N r2) note("Some explanation of the xtreg R2 statistic") mlab(OLS RE)
            
            --------------------------------------------
                                  (1)             (2)   
                                  OLS              RE   
            --------------------------------------------
            mvalue              0.116***        0.110***
                              (19.80)         (10.46)   
            
            kstock              0.231***        0.308***
                               (9.05)         (17.93)   
            
            _cons              -42.71***       -57.83*  
                              (-4.49)         (-2.00)   
            --------------------------------------------
            N                     200             200   
            r2                  0.812           0.806   
            --------------------------------------------
            Some explanation of the xtreg R2 statistic
            * p<0.05, ** p<0.01, *** p<0.001
            
            .

            Comment


            • #7
              Here is a solution based on asdoc
              Code:
              ssc install asdoc
              webuse grunfeld, clear
              asdoc regress invest mvalue kstock, nest cnames(OLS) replace
              asdoc xtreg invest mvalue kstock, nest cnames(RE)
              
              
                0 |1                                      2                   3 
              ----+-----------------------------------------------------------------------------
                1 |                                     (1)                 (2) 
                2 |                                     OLS                  RE 
              ----+-----------------------------------------------------------------------------
                3 |mvalue                          0.116***             0.11*** 
                4 |                                 (0.006)              (0.01) 
                5 |kstock                          0.231***            0.308*** 
                6 |                                 (0.025)             (0.017) 
                7 |_cons                         -42.714***           -57.834** 
                8 |                                 (9.512)            (28.899) 
                9 |Observations                         200                 200 
               10 |R2                                 0.812               0.806 
              ----------------------------------------------------------------------------------
              Regards
              --------------------------------------------------
              Attaullah Shah, PhD.
              Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
              FinTechProfessor.com
              https://asdocx.com
              Check out my asdoc program, which sends outputs to MS Word.
              For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

              Comment


              • #8
                Originally posted by Andrew Musau View Post
                The R-squared statistic from regress is unambiguous, and is the model sum of squares divided by the total sum of squares from that regression. This is not the case for xtreg where you have 3 different R-squared statistics (between, within and overall). None of these is directly comparable to the statistic from regress, so wanting to display each of these on the same table and give them the same name is problematic. Doing it in esttab (from SSC, as you are asked to explain in FAQ Advice #12) is not difficult, but if you do so, add a note at the foot of the table alerting the reader not to do a straight comparison. You can find the definition of the xtreg R2-statistics from the manual entry of xtreg https://www.stata.com/manuals13/xtxtreg.pdf. Assuming that you want the overall R-squared statistic from xtreg (a similar logic applies to the others):

                Code:
                webuse grunfeld, clear
                eststo m1: regress invest mvalue kstock
                eststo m2: xtreg invest mvalue kstock
                estadd scalar r2= e(r2_o)
                esttab m1 m2, scalars(N r2) note("Some explanation of the xtreg R2 statistic") mlab(OLS RE)
                Res.:

                Code:
                . esttab m1 m2, scalars(N r2) note("Some explanation of the xtreg R2 statistic") mlab(OLS RE)
                
                --------------------------------------------
                (1) (2)
                OLS RE
                --------------------------------------------
                mvalue 0.116*** 0.110***
                (19.80) (10.46)
                
                kstock 0.231*** 0.308***
                (9.05) (17.93)
                
                _cons -42.71*** -57.83*
                (-4.49) (-2.00)
                --------------------------------------------
                N 200 200
                r2 0.812 0.806
                --------------------------------------------
                Some explanation of the xtreg R2 statistic
                * p<0.05, ** p<0.01, *** p<0.001
                
                .
                Dear Musau, the issue remain th same after applying your code, any other soluation?

                Comment


                • #9
                  It works for me. Try

                  Code:
                  ssc install estout, replace

                  Comment


                  • #10
                    Originally posted by Attaullah Shah View Post
                    Here is a solution based on asdoc
                    Code:
                    ssc install asdoc
                    webuse grunfeld, clear
                    asdoc regress invest mvalue kstock, nest cnames(OLS) replace
                    asdoc xtreg invest mvalue kstock, nest cnames(RE)
                    
                    
                    0 |1 2 3
                    ----+-----------------------------------------------------------------------------
                    1 | (1) (2)
                    2 | OLS RE
                    ----+-----------------------------------------------------------------------------
                    3 |mvalue 0.116*** 0.11***
                    4 | (0.006) (0.01)
                    5 |kstock 0.231*** 0.308***
                    6 | (0.025) (0.017)
                    7 |_cons -42.714*** -57.834**
                    8 | (9.512) (28.899)
                    9 |Observations 200 200
                    10 |R2 0.812 0.806
                    ----------------------------------------------------------------------------------
                    Dear Sir, I have used it, the result appears like this, and the issue remains unresolved
                    Obs. 1526 1526 1526 1526 1582 1582 1582 1582
                    Pseudo R2 .z .z .z .z .z .z .z .z
                    Year dummies yes yes yes yes yes yes
                    industry dummies yes yes yes yes yes yes

                    Comment


                    • #11
                      Originally posted by Andrew Musau View Post
                      It works for me. Try

                      Code:
                      ssc install estout, replace
                      Dear Musau, Same issue again, my data is
                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input str7 companies int year byte thesamenetworkauditor double psxsectorcode byte(affiliation1 firmauditedbybig4) float(InstitOwnAggreg familyownership BlockOwn_10 Manager_own Bsize abs_KTM)
                      "ANTM"  2010 0 828 0 .            0        . 1        . .            .
                      "ANTM"  2011 0 828 0 .            0        . 1        . .            .
                      "ANTM"  2012 0 828 0 0   .064611696    .7176 1    .3776 8    .08571542
                      "ANTM"  2013 0 828 0 0   .064611696    .7176 1    .3776 8    .01586557
                      "ANTM"  2014 0 828 0 0   .064611696    .0015 0    .0057 8    .01919296
                      "ANTM"  2015 0 828 0 0    .05323147        0 0     .006 7            .
                      "ANTM"  2016 0 828 0 0    .04725724    .0028 0    .0057 7            .
                      "ANTM"  2017 0 828 0 0    .04725724    .0047 0    .0066 7            .
                      "ANTM"  2018 0 828 0 0    .04725724    .0052 0    .0081 7            .
                      "ANTM"  2019 0 828 0 0    .04725724    .0072 0    .0082 7    .13654472
                      "ABOT"  2010 0 823 0 0    .08904193        0 0   .00038 7            .
                      "ABOT"  2011 0 823 0 0    .08769335        0 0   .00038 7    .23240325
                      "ABOT"  2012 0 823 0 0    .07502335        0 0   .00038 7    .27517605
                      "ABOT"  2013 0 823 0 0    .05420093        0 0   .00038 7    .20776977
                      "ABOT"  2014 0 823 0 1    .05400541        0 0   .00038 7     .2476054
                      "ABOT"  2015 0 823 0 1    .05709202        0 0    .0004 7     .2474561
                      "ABOT"  2016 0 823 0 1    .08496767        0 0   .00043 7    .14436993
                      "ABOT"  2017 0 823 0 1     .1004569        0 0   .00043 7      .278778
                      "ABOT"  2018 0 823 0 1    .04323109        0 0    .0005 7    .09935506
                      "ABOT"  2019 0 823 0 1    .04656527        0 0    .0004 7            .
                      "AGSML" 2010 0 826 0 0   .003760759        0 0        0 7            .
                      "AGSML" 2011 0 826 0 0            0        0 0        0 7            .
                      "AGSML" 2012 0 826 0 0   .002378199        0 0        0 7            .
                      "AGSML" 2013 0 826 0 .            0        0 0        0 .            .
                      "AGSML" 2014 0 826 0 0    .04673046        0 0        0 7            .
                      "AGSML" 2015 0 826 0 0    .15590754        0 0        0 7            .
                      "AGSML" 2016 0 826 0 0     .0692838        0 0        0 7            .
                      "AGSML" 2017 0 826 0 0     .0692838        0 0        0 7            .
                      "AGSML" 2018 0 826 0 0     .0692838        0 0        0 7            .
                      "AGSML" 2019 0 826 0 0     .0692838        0 0        0 7            .
                      "ADAMS" 2010 0 826 1 0  .0007300924   .62733 1   .01887 7            .
                      "ADAMS" 2011 0 826 1 0 .00014313836   .62741 1   .01887 7    .01865147
                      "ADAMS" 2012 0 826 1 0 .00014313836   .62878 1   .02013 7    .27723503
                      "ADAMS" 2013 0 826 1 0  .0006133262   .62869 1   .02013 7    .21216252
                      "ADAMS" 2014 0 826 1 0  .0000109884   .70745 1    .5046 7    .07517353
                      "ADAMS" 2015 0 826 1 0     .2068587   .70703 1   .50418 7    .13294512
                      "ADAMS" 2016 0 826 1 0     .2068587   .70992 1   .50418 7    .10186207
                      "ADAMS" 2017 0 826 1 0 .00004088841   .70992 1   .50418 7            .
                      "ADAMS" 2018 0 826 1 0 .00004088841   .70992 1   .50418 7            .
                      "ADAMS" 2019 0 826 1 0 .00004088841   .70992 1   .50418 7            .
                      "ADOS"  2010 0 808 0 0            . .7389399 1 .7389399 .            .
                      "ADOS"  2011 0 808 0 0   .003144654 .7389399 1 .7389399 7      .372377
                      "ADOS"  2012 0 808 0 0   .003463677 .7389399 1 .7389399 7     .3257872
                      "ADOS"  2013 0 808 0 0    .09247106 .7389399 1 .7389399 7    .26192567
                      "ADOS"  2014 0 808 0 0    .09237879   .73423 1   .73423 7    .05110693
                      "ADOS"  2015 0 808 0 0    .08957742   .73431 1   .73431 9    .17759146
                      "ADOS"  2016 0 808 0 0     .0894244   .73127 1   .73127 9   .031859938
                      "ADOS"  2017 0 808 0 0   .008212273   .73119 1   .73119 9            .
                      "ADOS"  2018 0 808 0 0   .008212273   .73119 1   .73119 9            .
                      "ADOS"  2019 0 808 0 0   .008212273   .73119 1   .73119 9            .
                      "AGIL"  2010 1 802 1 .            .        0 0        0 7            .
                      "AGIL"  2011 1 802 1 1     .1532879        0 0    .0003 7    .12354458
                      "AGIL"  2012 1 802 1 1    .13130295        0 0    .0003 7    .14708623
                      "AGIL"  2013 1 802 1 1    .12511535        0 0   .00033 7 .00004516105
                      "AGIL"  2014 1 802 1 1    .16996183        0 0   .00033 7    .12454236
                      "AGIL"  2015 1 802 1 1            0        0 0   .00024 7    .02653834
                      "AGIL"  2016 1 802 1 1     .1836675        0 0   .00024 7    .17797667
                      "AGIL"  2017 1 802 1 1     .1836675        0 0   .00057 7    .09978685
                      "AGIL"  2018 1 802 1 1    .15773994        0 0        0 7    .06755728
                      "AGIL"  2019 1 802 1 1     .1519675        0 0        0 7     .0297376
                      "AGL"   2010 1 805 0 0     .0438393        0 0        0 .            .
                      "AGL"   2011 1 805 0 1     .9926597        0 0        0 8  .0026342415
                      "AGL"   2012 1 805 0 1     .0045397        0 0        0 7    .10088913
                      "AGL"   2013 1 805 0 1     .9878687        0 0        0 8            .
                      "AGL"   2014 1 805 0 1     .0115969        0 0        0 8            .
                      "AGL"   2015 1 805 0 1     .9779001        0 0        0 8            .
                      "AGL"   2016 1 805 0 1     .9092752        0 0        0 8            .
                      "AGL"   2017 1 805 0 1   .009032418        0 0        0 7            .
                      "AGL"   2018 1 805 0 1    .26850897        0 0        0 7            .
                      "AGL"   2019 1 805 0 0     .8598847        0 0        0 7            .
                      "AHTM"  2010 1 828 1 0     .9693096    .4079 1    .4079 7            .
                      "AHTM"  2011 1 828 1 0    .07158407   .42389 1   .42389 7   .019990465
                      "AHTM"  2012 0 828 0 0    .07158407   .42389 1   .42389 7     .0448332
                      "AHTM"  2013 0 828 0 1  .0005382334   .49288 1   .49285 7   .008159353
                      "AHTM"  2014 0 828 0 0    .06406907   .49288 1   .49285 7     .1085841
                      "AHTM"  2015 0 828 0 0    .06382143   .49288 1   .49285 7   .026472777
                      "AHTM"  2016 0 828 0 0    .06382143   .49288 1   .49285 7     .0826352
                      "AHTM"  2017 0 828 0 0    .06406261   .49285 1   .49285 7    .10795268
                      "AHTM"  2018 0 828 0 0    .06982501   .49438 1   .49285 8   .018498437
                      "AHTM"  2019 0 828 0 0    .06982501   .49438 1   .49285 8    .04769975
                      "ASL"   2010 1 808 1 .            .        . 1        . .            .
                      "ASL"   2011 1 808 1 .            .        . 1        . .            .
                      "ASL"   2012 1 808 1 1   .005802211    .3984 1    .3984 8            .
                      "ASL"   2013 1 808 1 1    .10399773    .0521 0    .0521 8            .
                      "ASL"   2014 1 808 1 1    .03392551    .0514 0    .0514 8            .
                      "ASL"   2015 1 808 1 1    .08157366    .0514 0    .0514 9            .
                      "ASL"   2016 1 808 1 1    .05972958    .0512 0    .0512 9            .
                      "ASL"   2017 1 808 1 1    .09998187    .2063 1    .2063 9    .00568456
                      "ASL"   2018 1 808 1 1    .15092263    .1804 1    .1804 9     .1125693
                      "ASL"   2019 1 808 1 1    .27568945    .1961 1    .1961 9    .27980396
                      "AKZO"  2010 0 805 0 .            .        . 1        . .            .
                      "AKZO"  2011 0 805 0 .            .        . 1        . .            .
                      "AKZO"  2012 0 805 0 .     .1165082        0 0        0 .     .5871577
                      "AKZO"  2013 0 805 0 .    .08702276        0 0        0 .     .0731278
                      "AKZO"  2014 0 805 0 1     .0619094        0 0        0 7   .013445818
                      "AKZO"  2015 0 805 0 1    .05915087        0 0        0 7    .08850758
                      "AKZO"  2016 0 805 0 1    .09241635        0 0        0 7    .09980697
                      "AKZO"  2017 0 805 0 1    .07455025        0 0        0 7    .08643355
                      "AKZO"  2018 0 805 0 1    .08025673        0 0        0 7    .12122718
                      "AKZO"  2019 0 805 0 1    .06945276        0 0        0 7     .1200663
                      The code which I have used are
                      eststo m1: reg abs_KTM_w ib0.affiliation1 firmauditedbybig4 InstitOwnAggreg_w familyownership_w BlockOwn_10_w Manager_own_w Bsize_w i.psxsectorcode i.year, cluster()
                      eststo m2: xtreg abs_KTM_w ib1.affiliation1 firmauditedbybig4 InstitOwnAggreg_w familyownership_w BlockOwn_10_w Manager_own_w Bsize_w i.psxsectorcode i.year, cluster()
                      eststo m3: xtreg abs_KTM_w ib0.affiliation1 firmauditedbybig4 InstitOwnAggreg_w familyownership_w BlockOwn_10_w Manager_own_w Bsize_w i.psxsectorcode i.year, cluster()
                      eststo m4: xtreg abs_KTM_w ib1.affiliation1 firmauditedbybig4 InstitOwnAggreg_w familyownership_w BlockOwn_10_w Manager_own_w Bsize_w i.psxsectorcode i.year, cluster()
                      the output results are
                      HTML Code:
                      esttab m1 m2 m3 m4, scalars(N r2 F) note("Some explanation of the xtreg R2 statistic") mlab(OLS OLS RE RE)
                      
                      ----------------------------------------------------------------------------
                                            (1)             (2)             (3)             (4)   
                                            OLS             OLS              RE              RE   
                      ----------------------------------------------------------------------------
                      0.affiliat~1            0          0.0191*              0          0.0191*  
                                            (.)          (2.45)             (.)          (2.45)   
                      
                      1.affiliat~1      -0.0207***            0         -0.0191*              0   
                                        (-4.03)             (.)         (-2.45)             (.)   
                      
                      firmaudite~4       0.0112*        0.00867         0.00867         0.00867   
                                         (2.18)          (1.22)          (1.22)          (1.22)   
                      
                      InstitOwnA~w      -0.0536*        -0.0478*        -0.0478*        -0.0478*  
                                        (-2.57)         (-2.01)         (-2.01)         (-2.01)   
                      
                      familyowne~w      -0.0106         -0.0110         -0.0110         -0.0110   
                                        (-0.53)         (-0.41)         (-0.41)         (-0.41)   
                      
                      BlockOw~10_w     -0.00503        -0.00301        -0.00301        -0.00301   
                                        (-0.63)         (-0.29)         (-0.29)         (-0.29)   
                      
                      Manager_ow~w      -0.0173         -0.0156         -0.0156         -0.0156   
                                        (-0.91)         (-0.62)         (-0.62)         (-0.62)   
                      
                      Bsize_w           0.00158         0.00199         0.00199         0.00199   
                                         (0.85)          (0.80)          (0.80)          (0.80)   
                      
                      801.psxsec~e            0               0               0               0   
                                            (.)             (.)             (.)             (.)   
                      
                      802.psxsec~e      -0.0857***      -0.0894**       -0.0894**       -0.0894** 
                                        (-4.77)         (-3.01)         (-3.01)         (-3.01)   
                      
                      803.psxsec~e       -0.108***       -0.114***       -0.114***       -0.114***
                                        (-5.40)         (-3.72)         (-3.72)         (-3.72)   
                      
                      804.psxsec~e      -0.0839***      -0.0891***      -0.0891***      -0.0891***
                                        (-6.64)         (-4.39)         (-4.39)         (-4.39)   
                      
                      805.psxsec~e      -0.0854***      -0.0920***      -0.0920***      -0.0920***
                                        (-7.09)         (-4.79)         (-4.79)         (-4.79)   
                      
                      808.psxsec~e      -0.0762***      -0.0804***      -0.0804***      -0.0804***
                                        (-4.71)         (-3.32)         (-3.32)         (-3.32)   
                      
                      809.psxsec~e      -0.0852***      -0.0873**       -0.0873**       -0.0873** 
                                        (-4.87)         (-3.13)         (-3.13)         (-3.13)   
                      
                      810.psxsec~e      -0.0580***      -0.0649**       -0.0649**       -0.0649** 
                                        (-4.36)         (-3.08)         (-3.08)         (-3.08)   
                      
                      811.psxsec~e      -0.0908***       -0.100***       -0.100***       -0.100***
                                        (-5.44)         (-3.84)         (-3.84)         (-3.84)   
                      
                      816.psxsec~e      -0.0687*        -0.0706         -0.0706         -0.0706   
                                        (-2.27)         (-1.38)         (-1.38)         (-1.38)   
                      
                      818.psxsec~e      -0.0918***      -0.0943***      -0.0943***      -0.0943***
                                        (-5.96)         (-3.87)         (-3.87)         (-3.87)   
                      
                      820.psxsec~e      -0.0613**       -0.0674*        -0.0674*        -0.0674*  
                                        (-3.26)         (-2.23)         (-2.23)         (-2.23)   
                      
                      821.psxsec~e      -0.0923***      -0.0983***      -0.0983***      -0.0983***
                                        (-4.89)         (-3.43)         (-3.43)         (-3.43)   
                      
                      822.psxsec~e       -0.111***       -0.115***       -0.115***       -0.115***
                                        (-6.75)         (-4.23)         (-4.23)         (-4.23)   
                      
                      823.psxsec~e      -0.0731***      -0.0776**       -0.0776**       -0.0776** 
                                        (-4.75)         (-3.16)         (-3.16)         (-3.16)   
                      
                      824.psxsec~e       -0.141***       -0.146**        -0.146**        -0.146** 
                                        (-4.44)         (-2.81)         (-2.81)         (-2.81)   
                      
                      825.psxsec~e       -0.108***       -0.122**        -0.122**        -0.122** 
                                        (-3.89)         (-3.08)         (-3.08)         (-3.08)   
                      
                      826.psxsec~e      -0.0358**       -0.0410*        -0.0410*        -0.0410*  
                                        (-2.77)         (-2.04)         (-2.04)         (-2.04)   
                      
                      827.psxsec~e       -0.100***       -0.108***       -0.108***       -0.108***
                                        (-4.89)         (-3.44)         (-3.44)         (-3.44)   
                      
                      828.psxsec~e      -0.0993***       -0.104***       -0.104***       -0.104***
                                        (-6.19)         (-4.16)         (-4.16)         (-4.16)   
                      
                      829.psxsec~e      -0.0809***      -0.0862***      -0.0862***      -0.0862***
                                        (-6.76)         (-4.55)         (-4.55)         (-4.55)   
                      
                      830.psxsec~e      -0.0870***      -0.0937***      -0.0937***      -0.0937***
                                        (-6.61)         (-4.52)         (-4.52)         (-4.52)   
                      
                      831.psxsec~e       -0.106***       -0.116***       -0.116***       -0.116***
                                        (-5.42)         (-3.69)         (-3.69)         (-3.69)   
                      
                      832.psxsec~e       0.0195         0.00992         0.00992         0.00992   
                                         (0.68)          (0.24)          (0.24)          (0.24)   
                      
                      833.psxsec~e       -0.173***       -0.150**        -0.150**        -0.150** 
                                        (-5.14)         (-3.20)         (-3.20)         (-3.20)   
                      
                      834.psxsec~e      -0.0584         -0.0212         -0.0212         -0.0212   
                                        (-1.92)         (-0.48)         (-0.48)         (-0.48)   
                      
                      835.psxsec~e      -0.0991*         -0.104          -0.104          -0.104   
                                        (-1.98)         (-1.67)         (-1.67)         (-1.67)   
                      
                      2011.year               0               0               0               0   
                                            (.)             (.)             (.)             (.)   
                      
                      2012.year         -0.0207*        -0.0198*        -0.0198*        -0.0198*  
                                        (-2.14)         (-2.28)         (-2.28)         (-2.28)   
                      
                      2013.year         -0.0104        -0.00871        -0.00871        -0.00871   
                                        (-1.09)         (-1.01)         (-1.01)         (-1.01)   
                      
                      2014.year         -0.0139         -0.0130         -0.0130         -0.0130   
                                        (-1.48)         (-1.53)         (-1.53)         (-1.53)   
                      
                      2015.year         -0.0140         -0.0134         -0.0134         -0.0134   
                                        (-1.47)         (-1.56)         (-1.56)         (-1.56)   
                      
                      2016.year        -0.00976        -0.00796        -0.00796        -0.00796   
                                        (-1.02)         (-0.92)         (-0.92)         (-0.92)   
                      
                      2017.year        -0.00957        -0.00821        -0.00821        -0.00821   
                                        (-1.01)         (-0.96)         (-0.96)         (-0.96)   
                      
                      2018.year        -0.00241        -0.00156        -0.00156        -0.00156   
                                        (-0.25)         (-0.18)         (-0.18)         (-0.18)   
                      
                      2019.year         -0.0182         -0.0169         -0.0169         -0.0169   
                                        (-1.89)         (-1.93)         (-1.93)         (-1.93)   
                      
                      _cons               0.194***        0.173***        0.192***        0.173***
                                         (9.91)          (6.47)          (7.11)          (6.47)   
                      ----------------------------------------------------------------------------
                      N                    1549            1549            1549            1549   
                      r2                  0.140                                                   
                      F                   5.986                                                   
                      ----------------------------------------------------------------------------
                      Some explanation of the xtreg R2 statistic
                      * p<0.05, ** p<0.01, *** p<0.001

                      Comment


                      • #12
                        I note from post #11 that your M2 model is not "OLS" as you label it in the esttab output, but rather "RE" from xtreg. identical to M4. So all three models M2, M3, and M4 that lack R2 are from xtreg. I also note that you have not included the estadd command that Andrew recommended, which must appear after each xtreg model (M3 and M4, since your M2 is probably supposed to be reg rather than xtreg). If you were to run Andrew's example omitting the estadd command, the results would be as yours - no R2 for the xtreg model.

                        Since this problem manifests itself with both esttab and asdoc, at this point the only conclusion is that your commands to run your models and store the estimates are in error, likely in the ways indicated in the preceding paragraph.
                        Last edited by William Lisowski; 10 Jan 2022, 08:55.

                        Comment


                        • #13
                          I have just updated asdoc on my site. The update fixes the issue related to reporting r-squared xtreg commands. Now the default in asdoc is to report the within r-squared for both fixed and random effects models. However, the r-squared will still be shown as .z if other models are combined xtreg commands. The reason is that the estimates table command reports .z for statistics that are not reported in e() macro. Since the r-squared values for xtreg might not be available in other types of regressions, the value is set to default, that is .z.

                          The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
                          Code:
                          net install asdoc, from(http://fintechprofessor.com) replace
                          Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.



                          Here is an example

                          Code:
                          webuse grunfeld
                          asdoc xtreg invest  mvalue kstock, nest  re replace
                          asdoc xtreg invest  mvalue , nest  fe
                          asdoc xtreg invest   , nest  fe tzok
                          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	35.8 KB
ID:	1645416


                          asdocx is now available

                          A more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

                          https://fintechprofessor.com/asdocx


                          Please do remember to cite asdoc. To cite:

                          In-text citation
                          Tables were created using asdoc, a Stata program written by Shah (2018).

                          Bibliography
                          Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.
                          Regards
                          --------------------------------------------------
                          Attaullah Shah, PhD.
                          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                          FinTechProfessor.com
                          https://asdocx.com
                          Check out my asdoc program, which sends outputs to MS Word.
                          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

                          Comment


                          • #14
                            Originally posted by Attaullah Shah View Post
                            I have just updated asdoc on my site. The update fixes the issue related to reporting r-squared xtreg commands. Now the default in asdoc is to report the within r-squared for both fixed and random effects models. However, the r-squared will still be shown as .z if other models are combined xtreg commands. The reason is that the estimates table command reports .z for statistics that are not reported in e() macro. Since the r-squared values for xtreg might not be available in other types of regressions, the value is set to default, that is .z.

                            The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
                            Code:
                            net install asdoc, from(http://fintechprofessor.com) replace
                            Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.



                            Here is an example

                            Code:
                            webuse grunfeld
                            asdoc xtreg invest mvalue kstock, nest re replace
                            asdoc xtreg invest mvalue , nest fe
                            asdoc xtreg invest , nest fe tzok
                            [ATTACH=CONFIG]n1645416[/ATTACH]

                            asdocx is now available

                            A more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

                            https://fintechprofessor.com/asdocx


                            Please do remember to cite asdoc. To cite:

                            In-text citation
                            Tables were created using asdoc, a Stata program written by Shah (2018).

                            Bibliography
                            Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.
                            Thank You Sir, for your help and time, its now reporting r2_w.

                            Comment

                            Working...
                            X