Announcement

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

  • Adding year effects in table using esttab command

    Dear all,
    Can any one help me how to add year effects (yes and No) in the output table of stata similar to published articles


    I have used the following commands ,but error was getting
    Code:
    xtreg assetrisk d_MP   CapitalRatio NIM lasset c.C5_Aggregate##i.MPR i.Year,fe vce (robust)
    note: 2019.Year omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs     =        201
    Group variable: bankname                        Number of groups  =         31
    
    R-sq:                                           Obs per group:
         within  = 0.1785                                         min =          1
         between = 0.0215                                         avg =        6.5
         overall = 0.0517                                         max =         14
    
                                                    F(19,30)          =       3.64
    corr(u_i, Xb)  = -0.5122                        Prob > F          =     0.0008
    
                                        (Std. Err. adjusted for 31 clusters in bankname)
    ------------------------------------------------------------------------------------
                       |               Robust
             assetrisk |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------------+----------------------------------------------------------------
                  d_MP |  -.1743155   .1709318    -1.02   0.316    -.5234048    .1747737
          CapitalRatio |  -.0384784   .0558685    -0.69   0.496    -.1525771    .0756203
                   NIM |  -2.360621   1.825148    -1.29   0.206     -6.08807    1.366827
                lasset |  -.6394246   .3908451    -1.64   0.112    -1.437637    .1587875
          C5_Aggregate |  -153.4295   138.9957    -1.10   0.278    -437.2966    130.4376
                       |
                   MPR |
                  TMP  |   13.78409   16.72047     0.82   0.416    -20.36366    47.93185
                       |
    MPR#c.C5_Aggregate |
                  TMP  |  -42.82791    47.5923    -0.90   0.375    -140.0244    54.36853
                       |
                  Year |
                 2007  |  -6.491238    5.70436    -1.14   0.264    -18.14109    5.158618
                 2008  |  -10.76539   9.901192    -1.09   0.286    -30.98632     9.45554
                 2009  |  -11.46698   10.40783    -1.10   0.279    -32.72261    9.788655
                 2010  |  -12.34658   11.62104    -1.06   0.297    -36.07991    11.38675
                 2011  |  -11.69355   11.03007    -1.06   0.298    -34.21996    10.83286
                 2012  |  -11.21224   10.61015    -1.06   0.299    -32.88106    10.45658
                 2013  |  -14.49289   12.86565    -1.13   0.269    -40.76805    11.78226
                 2014  |  -11.47577   10.48648    -1.09   0.283    -32.89201    9.940476
                 2015  |  -11.99408    10.5234    -1.14   0.263    -33.48573     9.49758
                 2016  |  -10.11857   8.909721    -1.14   0.265    -28.31465    8.077511
                 2017  |  -7.475781   6.384621    -1.17   0.251    -20.51492    5.563355
                 2018  |  -.7794947   2.310377    -0.34   0.738    -5.497915    3.938925
                 2019  |          0  (omitted)
                       |
                 _cons |    86.1897   72.54137     1.19   0.244    -61.95954    234.3389
    -------------------+----------------------------------------------------------------
               sigma_u |  4.4049164
               sigma_e |  7.4528112
                   rho |   .2588911   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------------
    
    . estadd local Year "yes"
    
    added macro:
                   e(Year) : "yes"
    
    . esttab using regin_foreign.csv, label("N" "Year fixed effect" ))se t(2) ar2 sfmt(222)brackets sta
    > r(* .10 ** .05 *** .01) nogap compress  ar2  drop(*year)
    option label() incorrectly specified
    r(198);

    Any help is highly appreciated

  • #2
    See the use of the option -indicate()- as in https://www.statalist.org/forums/for...-visualization or using the command estadd as in https://www.statalist.org/forums/for...-esttab-estadd. esttab and estadd are available from the estout package which can be installed from the Stata Journal or SSC.

    Comment


    • #3
      Thankyou so much Andrew Musau .
      The command was working fine for me ,but I am getting all the year effects as yes only.Is getting like that is right ?

      Code:
      esttab ,se indicate(Year effects= *.Year) s(r2 N, lab("R-squared" "Observations")) star(* 0.1 ** 
      > 0.05 *** 0.01 )t(2) ar2 sfmt(222)brackets nogap compress
      
      {hline 322}
                       (1)          (2)          (3)          (4)          (5)          (6)          (7) 
      >          (8)          (9)         (10)         (11)         (12)         (13)         (14)       
      >   (15)         (16)         (17)         (18)         (19)         (20)         (21)         (22)
      >          (23)         (24)   
                    zscore       zscore       zscore       zscore    NPL_asset    NPL_asset    NPL_asset 
      >    NPL_asset    assetrisk    assetrisk    assetrisk    assetrisk       zscore       zscore       
      > zscore       zscore    NPL_asset    NPL_asset    NPL_asset    NPL_asset    assetrisk    assetrisk
      >     assetrisk    assetrisk   
      {hline 322}
      d_MP        -0.00462     -0.00498      -0.0223      -0.0226     -0.00834     -0.00976     0.000283 
      >     0.000411      -0.0205      -0.0180      -0.0345      -0.0389     -0.00747     -0.00754      -
      > 0.0215**    -0.0215**    0.00915      0.00727      0.00826      0.00815      -0.0674      -0.0618
      >       -0.0739      -0.0718   
                  [0.0171]     [0.0170]     [0.0179]     [0.0179]    [0.00823]    [0.00852]    [0.00510] 
      >    [0.00512]     [0.0883]     [0.0898]     [0.0910]     [0.0889]     [0.0106]     [0.0105]    [0.
      > 00985]    [0.00984]    [0.00903]    [0.00866]    [0.00578]    [0.00572]     [0.0624]     [0.0577]
      >      [0.0679]     [0.0660]   
      CapitalR~o   -0.0178      -0.0178      -0.0208***   -0.0208***   0.00850      0.00849     -0.00533 
      >     -0.00379      -0.0443      -0.0428      -0.0255      -0.0829     -0.00463     -0.00464       
      > 0.0150       0.0151     -0.00913     -0.00923      0.00286      0.00268      -0.0504      -0.0472
      >        -30.29       -29.99   
                  [0.0142]     [0.0143]    [0.00753]    [0.00753]    [0.00813]    [0.00812]     [0.0932] 
      >     [0.0929]     [0.0311]     [0.0300]      [1.060]      [1.027]     [0.0112]     [0.0112]     [0
      > .0162]     [0.0162]     [0.0125]     [0.0127]      [0.322]      [0.322]     [0.0580]     [0.0558]
      >       [26.72]      [26.62]   
      NIM           0.0863***    0.0866***    0.0535       0.0537      -0.0526*     -0.0512*     -0.0135*
      >      -0.0135*     -0.0496      -0.0504       -0.155       -0.153       0.0108       0.0107     -0
      > .00249     -0.00233       0.0600       0.0589       0.0309       0.0311       -1.190       -1.189
      >        -1.908       -1.887   
                  [0.0330]     [0.0329]     [0.0467]     [0.0466]     [0.0269]     [0.0261]    [0.00796] 
      >    [0.00795]     [0.0587]     [0.0598]      [0.137]      [0.134]     [0.0742]     [0.0743]     [0
      > .0928]     [0.0927]     [0.0398]     [0.0390]     [0.0293]     [0.0294]      [1.099]      [1.100]
      >       [1.707]      [1.689]   
      lasset       -0.0117      -0.0115      -0.0397      -0.0393      -0.0516**    -0.0511**   -0.00187 
      >     -0.00186       -0.232       -0.231       -0.363       -0.362       0.0550       0.0550       
      >  0.185        0.185       -0.373**     -0.371**     -0.161       -0.161        0.115        0.118
      >        0.0778       0.0835   
                  [0.0180]     [0.0181]     [0.0259]     [0.0259]     [0.0222]     [0.0221]    [0.00343] 
      >    [0.00344]      [0.147]      [0.146]      [0.255]      [0.254]     [0.0398]     [0.0399]      [
      > 0.179]      [0.180]      [0.154]      [0.154]      [0.116]      [0.116]      [0.174]      [0.176]
      >       [0.307]      [0.303]   
      HHI_Asse~e    -8.859                                               67.65*                          
      >                    -40.20                                              -19.61                    
      >                            112.2*                                             -129.5             
      >                              
                   [13.14]                                             [36.29]                           
      >                   [73.72]                                             [12.32]                    
      >                          [57.07]                                             [131.4]             
      >                              
      1.MPR              0            0            0            0            0            0            0 
      >            0            0            0            0            0            0            0       
      >      0            0            0            0            0            0            0            0
      >             0            0   
                       [.]          [.]          [.]          [.]          [.]          [.]          [.] 
      >          [.]          [.]          [.]          [.]          [.]          [.]          [.]       
      >    [.]          [.]          [.]          [.]          [.]          [.]          [.]          [.]
      >           [.]          [.]   
      2.MPR          0.819        1.674        5.468       -2.256        2.495        5.139       -0.355 
      >        0.294       -0.465        5.728       -5.576       -6.832        0.302        0.759       
      > -0.942        0.316        2.954        5.974        0.772       -0.387       -2.854        2.757
      >        -37.87        7.899   
                   [0.661]      [1.426]      [4.361]      [1.533]      [1.848]      [3.847]      [0.391] 
      >      [0.204]      [1.732]      [4.042]      [6.948]      [7.457]      [0.535]      [1.169]      [
      > 2.407]      [0.973]      [1.871]      [3.797]      [0.677]      [0.335]      [2.987]      [3.086]
      >       [36.77]      [9.278]   
      1.MPR#c.~e         0                                                   0                           
      >                         0                                                   0                    
      >                                0                                                   0             
      >                              
                       [.]                                                 [.]                           
      >                       [.]                                                 [.]                    
      >                              [.]                                                 [.]             
      >                              
      2.MPR#c.~e    -15.13                                              -46.66                           
      >                    -9.411                                              -4.888                    
      >                           -54.97                                               31.85             
      >                              
                   [11.41]                                             [34.08]                           
      >                   [20.81]                                             [9.451]                    
      >                          [34.70]                                             [37.25]             
      >                              
      C5_Aggre~e                 -4.775                                               22.65*             
      >                                 -2.906                                              -7.673*      
      >                                         39.22**                                            -29.57
      >                              
                                [4.554]                                             [11.72]              
      >                                [16.60]                                             [4.277]       
      >                                       [19.52]                                             [30.86]
      >                              
      1.MPR#c.~e                      0                                                   0              
      >                                      0                                                   0       
      >                                             0                                                   0
      >                              
                                    [.]                                                 [.]              
      >                                    [.]                                                 [.]       
      >                                           [.]                                                 [.]
      >                              
      2.MPR#c.~e                 -4.348                                              -13.42              
      >                                 -16.91                                              -1.859       
      >                                        -15.58                                              -9.480
      >                              
                                [3.578]                                             [9.970]              
      >                                [11.91]                                             [2.988]       
      >                                       [9.882]                                             [9.693]
      >                              
      Boone_Ind                                12.16                                              -8.676 
      >                                               28.70                                              
      >  9.570                                              -18.10*                                      
      >        -13.97                
                                             [16.56]                                             [8.516] 
      >                                             [46.57]                                             [
      > 14.20]                                             [10.12]                                       
      >       [52.29]                
      1.MPR#c.~d                                   0                                                   0 
      >                                                   0                                              
      >      0                                                   0                                       
      >             0                
                                                 [.]                                                 [.] 
      >                                                 [.]                                              
      >    [.]                                                 [.]                                       
      >           [.]                
      2.MPR#c.~d                              -20.91                                               1.410 
      >                                               15.91                                              
      >  3.681                                              -2.841                                       
      >         136.5                
                                             [16.69]                                             [1.455] 
      >                                             [23.44]                                             [
      > 8.944]                                             [2.514]                                       
      >       [133.2]                
      Learners~x                                            1.435                                        
      >       -127.9                                               801.3                                 
      >               27.15                                              -366.0*                         
      >                     2139.2   
                                                          [14.26]                                        
      >      [148.1]                                             [937.6]                                 
      >             [28.83]                                             [211.0]                          
      >                   [1902.5]   
      1.MPR#c.~x                                                0                                        
      >            0                                                   0                                 
      >                   0                                                   0                          
      >                          0   
                                                              [.]                                        
      >          [.]                                                 [.]                                 
      >                 [.]                                                 [.]                          
      >                        [.]   
      2.MPR#c.~x                                           -21.81                                        
      >        2.747                                              -54.50                                 
      >               2.817                                              -4.066                          
      >                      95.65   
                                                          [14.60]                                        
      >      [1.973]                                             [62.52]                                 
      >             [9.934]                                             [3.397]                          
      >                    [106.0]   
      _cons          1.006        2.486       -2.331        1.076       -2.984*      -8.249*       2.424 
      >       -12.31        7.145        6.149       -0.835        84.72        1.129        3.158*      
      > -3.692        1.471       -2.772       -12.25*       6.325*      -34.01*       12.49        17.16
      >         13.79        217.5   
                   [0.804]      [1.858]      [4.372]      [1.517]      [1.760]      [4.387]      [2.211] 
      >      [14.44]      [7.604]      [9.861]      [9.753]      [95.45]      [0.773]      [1.691]      [
      > 5.281]      [1.397]      [1.892]      [6.471]      [3.492]      [19.81]      [11.35]      [16.38]
      >       [20.33]      [192.3]   
      Year eff~s       Yes          Yes          Yes          Yes          Yes          Yes          Yes 
      >          Yes          Yes          Yes          Yes          Yes          Yes          Yes       
      >    Yes          Yes          Yes          Yes          Yes          Yes          Yes          Yes
      >           Yes          Yes   
      {hline 322}
      R-squared     0.0527       0.0524       0.0429       0.0411       0.0783       0.0748       0.0203 
      >       0.0204       0.0382       0.0395       0.0448       0.0455       0.0506       0.0507       
      > 0.0322       0.0320        0.237        0.233       0.0545       0.0546       0.0691       0.0690
      >         0.126        0.121   
      Observat~s      1007         1007          646          646          857          857          560 
      >          560          780          780          523          523         1007         1007       
      >    646          646          857          857          560          560          780          780
      >           523          523   
      {hline 322}
      Standard errors in brackets
      * p<0.1, ** p<0.05, *** p<0.01
      
      .

      Comment


      • #4
        Probably all models have year indicators. Otherwise update estout and present a reproducible example if the issue persists. The following works for me:

        Code:
        webuse grunfeld, clear
        eststo m1: regress invest mvalue
        eststo m2: regress invest mvalue i.year
        eststo m3: regress invest mvalue kstock 
        esttab m1 m2 m3, indicate(Year effects= *.year)
        Res.:

        Code:
        . esttab m1 m2 m3, indicate(Year effects= *.year) drop(_cons)
        
        ------------------------------------------------------------
                              (1)             (2)             (3)   
                           invest          invest          invest   
        ------------------------------------------------------------
        mvalue              0.141***        0.140***        0.116***
                          (23.39)         (23.35)         (19.80)   
        
        kstock                                              0.231***
                                                           (9.05)   
        
        Year effects           No             Yes              No   
        ------------------------------------------------------------
        N                     200             200             200   
        ------------------------------------------------------------
        t statistics in parentheses
        * p<0.05, ** p<0.01, *** p<0.001

        Comment


        • #5
          Thankyou so much again Andrew Musau .I just have one more qurey ,can u please help me on this
          when I am creatiting table using eststo for quantile regression the results is like below
          Code:
           
          (1)
          zscore
          q10
          d_MP -0.0139
          [0.0182]
          HHI_Asset_Aggregate -60.59***
          [21.00]
          CapitalRatio 0.0247
          [0.377]
          NIM 0.0806*
          [0.0419]
          lasset 0.108***
          [0.0297]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 2.175*
          [1.216]
          q20
          d_MP -0.0213
          [0.0154]
          HHI_Asset_Aggregate -47.48***
          [14.85]
          CapitalRatio 0.00176
          [0.266]
          NIM 0.0844***
          [0.0305]
          lasset 0.0375
          [0.0233]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 2.312***
          [0.832]
          q30
          d_MP -0.0126
          [0.0159]
          HHI_Asset_Aggregate -15.27
          [10.88]
          CapitalRatio -0.00747
          [0.0446]
          NIM 0.0995***
          [0.0297]
          lasset 0.00822
          [0.0108]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.844
          [0.588]
          q40
          d_MP -0.00102
          [0.0107]
          HHI_Asset_Aggregate -14.67**
          [6.104]
          CapitalRatio -0.0173
          [0.0261]
          NIM 0.130***
          [0.0251]
          lasset 0.000603
          [0.00907]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.943**
          [0.385]
          q50
          d_MP -0.00496
          [0.00982]
          HHI_Asset_Aggregate -8.872
          [5.516]
          CapitalRatio -0.0184
          [0.0261]
          NIM 0.124***
          [0.0209]
          lasset -0.0170
          [0.0110]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.878**
          [0.351]
          q60
          d_MP -0.00395
          [0.0102]
          HHI_Asset_Aggregate -6.870*
          [4.065]
          CapitalRatio -0.00810
          [0.0205]
          NIM 0.160***
          [0.0158]
          lasset -0.0298***
          [0.00942]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.870***
          [0.278]
          q70
          d_MP -0.0120
          [0.0103]
          HHI_Asset_Aggregate -2.257
          [4.774]
          CapitalRatio -0.0115
          [0.0197]
          NIM 0.171***
          [0.0178]
          lasset -0.0347***
          [0.00908]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.688**
          [0.288]
          q80
          d_MP 0.00718
          [0.0121]
          HHI_Asset_Aggregate 6.012
          [6.240]
          CapitalRatio -0.0199
          [0.0128]
          NIM 0.184***
          [0.0155]
          lasset -0.0647***
          [0.0126]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.586
          [0.421]
          q90
          d_MP 0.0146
          [0.0310]
          HHI_Asset_Aggregate 17.63
          [13.31]
          CapitalRatio -0.0357
          [0.117]
          NIM 0.162***
          [0.0262]
          lasset -0.135***
          [0.0247]
          C5_Aggregate
          Boone_Ind
          LearnersIndex
          _cons 0.865
          [0.999]
          Year effects Yes
          R-squared
          Observations 1007
          Standard errors in brackets
          ="* p<0.1 ** p<0.05
          is there any way I can get the results in a row like q10 q20 q30 like that

          Comment


          • #6
            Use the -unstack- option

            Code:
            esttab, unstack

            Comment

            Working...
            X