Announcement

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

  • Testing for time-fixed effects - testparm!

    Hi,

    I am doing a fixed effects regression and I am a bit worried, that I should include year dummies, which I am currently not.
    I did use the forum search, but I did not find a satisfying answer...
    So - first I do:
    Code:
    xtreg $ylist $xlist i.Year, fe
    testparm i.Year
    resulting in:

    Code:
     ( 1)  2005.Year = 0
     ( 2)  2006.Year = 0
     ( 3)  2007.Year = 0
     ( 4)  2008.Year = 0
     ( 5)  2009.Year = 0
     ( 6)  2010.Year = 0
     ( 7)  2011.Year = 0
     ( 8)  2012.Year = 0
     ( 9)  2013.Year = 0
    
           F(  9,   143) =   47.31
                Prob > F =    0.0000
    Does that mean: We reject the null that the coefficients for all years are jointly equal to zero, therefore time fixedeffects are needed in this case.
    And if I need time effects - is that simply done by including i.Year dummies?

  • #2
    you are correct.
    see slide 31 here:
    http://www.princeton.edu/~otorres/Panel101.pdf

    Comment


    • #3
      In short: yes and yes.

      As an aside, you might want to consider robust standard errors by using the option vce(robust). In principle this affects the test statistic, although this will not change the conclusion in your case because the test statistic is far enough away from any critical value.
      https://twitter.com/Kripfganz

      Comment


      • #4
        thanks very much to both of you....
        allow me one follow-up question:

        If i include the year-dummies, I inevetably get a much higher r²-within.
        but now it doesnt explain the variance of my indepedent variables anymore - well yes it does, but they include the dummies - it makes the interpetation of r² tricky.
        anyway to deal with this?

        Comment


        • #5
          I would suggest reading about the various R squared (overall, between, within) in the stata manual entry regarding xtreg (also probably in the Princeton slides i linked to). in short: yes, the interpretation of R^2 is tricky with panel models, but this is regardless of whether or not you're using time dummies

          Comment


          • #6
            Jepp - that wasnt really my question - if its tricky or not =)
            My mistake...
            With time dummies, my r²-withing goes up from 0.599 to 0.909 - which would normally be a great value.
            But since the time dummies obvioulsly have a huge impact, referencing the new r² makes no sense.
            The time dummies are of course part of my modell but not part of my explenatory set of variables ...

            Comment


            • #7
              Originally posted by till deg View Post
              Jepp - that wasnt really my question - if its tricky or not =)
              My mistake...
              With time dummies, my r²-withing goes up from 0.599 to 0.909 - which would normally be a great value.
              But since the time dummies obvioulsly have a huge impact, referencing the new r² makes no sense.
              The time dummies are of course part of my modell but not part of my explenatory set of variables ...
              I have the same question.
              I read that you should run the OLS regression with the dummies and take the R^2 for interpretation from there, though I'm not sure. Could anyone clarify please?

              Comment


              • #8
                In general, you would be interested in the proportion of variance explained by the explanatory variables, not by nuisance variables like time indicators (dummies). To get that, you run the model twice. First you run the model with both the explanatory variables and the nuisance variables (full model). Then you run the model again with just the nuisance variables and be sure to restrict it to the estimation sample of the full model. This is called the reduced model. The difference R2full model - R2reduced model is the proportion of variance associated with the explanatory variables (when entered last). That is the most widely accepted way to describe things.

                Comment


                • #9
                  Till:
                  you would get more helpful replies if you posted the outcome table of -xtreg, fe-, too. Thanks.
                  Last edited by Carlo Lazzaro; 05 Oct 2017, 01:39.
                  Kind regards,
                  Carlo
                  (Stata 18.0 SE)

                  Comment


                  • #10
                    Originally posted by Clyde Schechter View Post
                    In general, you would be interested in the proportion of variance explained by the explanatory variables, not by nuisance variables like time indicators (dummies). To get that, you run the model twice. First you run the model with both the explanatory variables and the nuisance variables (full model). Then you run the model again with just the nuisance variables and be sure to restrict it to the estimation sample of the full model. This is called the reduced model. The difference R2full model - R2reduced model is the proportion of variance associated with the explanatory variables (when entered last). That is the most widely accepted way to describe things.
                    Thank you Clyde!

                    Comment


                    • #11

                      In general, you would be interested in the proportion of variance explained by the explanatory variables, not by nuisance variables like time indicators (dummies). To get that, you run the model twice. First you run the model with both the explanatory variables and the nuisance variables (full model). Then you run the model again with just the nuisance variables and be sure to restrict it to the estimation sample of the full model. This is called the reduced model. The difference R2full model - R2reduced model is the proportion of variance associated with the explanatory variables (when entered last). That is the most widely accepted way to describe things.
                      Hi,
                      could you pease be a bit more detailed on the R² reduced model? How do I run the R² reduced model?
                      And how do I calculate the difference R2full model - R2reduced mode in Stata?

                      Thank you very much!

                      Code:
                      testparm i.year
                      
                       ( 1)  1996.year = 0
                       ( 2)  1997.year = 0
                       ( 3)  1998.year = 0
                       ( 4)  1999.year = 0
                       ( 5)  2000.year = 0
                       ( 6)  2001.year = 0
                       ( 7)  2002.year = 0
                       ( 8)  2003.year = 0
                       ( 9)  2004.year = 0
                       (10)  2005.year = 0
                       (11)  2006.year = 0
                       (12)  2007.year = 0
                       (13)  2008.year = 0
                       (14)  2009.year = 0
                       (15)  2010.year = 0
                       (16)  2011.year = 0
                       (17)  2012.year = 0
                       (18)  2013.year = 0
                       (19)  2014.year = 0
                       (20)  2015.year = 0
                       (21)  2016.year = 0
                       (22)  2017.year = 0
                       (23)  2018.year = 0
                      
                             F( 23,156197) =   69.98
                                  Prob > F =    0.0000

                      Code:
                      xtreg Z_score LLR LLP NPA, fe
                      
                      Fixed-effects (within) regression               Number of obs     =    172,431
                      Group variable: id                              Number of groups  =     16,208
                      
                      R-sq:                                           Obs per group:
                           within  = 0.1567                                         min =          1
                           between = 0.0345                                         avg =       10.6
                           overall = 0.0779                                         max =         24
                      
                                                                      F(3,156220)       =    9674.73
                      corr(u_i, Xb)  = -0.0715                        Prob > F          =     0.0000
                      
                      ------------------------------------------------------------------------------
                           Z_score |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                               LLR |   5.868449   .1225112    47.90   0.000     5.628329    6.108568
                               LLP |  -.0000898   .0000228    -3.94   0.000    -.0001345   -.0000452
                               NPA |   3.946458   .0328891   119.99   0.000     3.881996     4.01092
                             _cons |  -1.742749   .0011278 -1545.21   0.000     -1.74496   -1.740539
                      -------------+----------------------------------------------------------------
                           sigma_u |  .28282775
                           sigma_e |  .19363385
                               rho |  .68086244   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                      F test that all u_i=0: F(16207, 156220) = 15.54              Prob > F = 0.0000
                      Code:
                      xtreg Z_score LLR LLP NPA i.year, fe
                      
                      Fixed-effects (within) regression               Number of obs     =    172,431
                      Group variable: id                              Number of groups  =     16,208
                      
                      R-sq:                                           Obs per group:
                           within  = 0.1653                                         min =          1
                           between = 0.0368                                         avg =       10.6
                           overall = 0.0833                                         max =         24
                      
                                                                      F(26,156197)      =    1189.56
                      corr(u_i, Xb)  = -0.0624                        Prob > F          =     0.0000
                      
                      ------------------------------------------------------------------------------
                           Z_score |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                               LLR |   5.743304   .1221302    47.03   0.000     5.503931    5.982676
                               LLP |  -.0000905   .0000227    -3.99   0.000     -.000135   -.0000461
                               NPA |   3.861483   .0348896   110.68   0.000       3.7931    3.929865
                                   |
                              year |
                             1996  |   .0011252    .002838     0.40   0.692    -.0044372    .0066875
                             1997  |  -.0109436   .0029121    -3.76   0.000    -.0166514   -.0052359
                             1998  |   .0014741   .0029709     0.50   0.620    -.0043489    .0072971
                             1999  |   .0298605   .0030124     9.91   0.000     .0239563    .0357647
                             2000  |   .0094353   .0030503     3.09   0.002     .0034568    .0154138
                             2001  |   .0234683   .0030814     7.62   0.000     .0174288    .0295079
                             2002  |   .0019659   .0031072     0.63   0.527    -.0041242     .008056
                             2003  |   .0063794   .0031259     2.04   0.041     .0002528     .012506
                             2004  |   .0015183   .0031485     0.48   0.630    -.0046527    .0076894
                             2005  |   -.000328   .0031704    -0.10   0.918    -.0065419    .0058858
                             2006  |  -.0185198   .0031924    -5.80   0.000    -.0247769   -.0122628
                             2007  |  -.0325805   .0032142   -10.14   0.000    -.0388804   -.0262807
                             2008  |   .0235797    .003257     7.24   0.000     .0171959    .0299634
                      Last edited by Katharina Maier; 12 Jun 2019, 13:30.

                      Comment


                      • #12
                        The reduced model contains only the "nuisance" variables, which in your case are the i.year indicators. So run
                        Code:
                        xtreg Z_score i.year, fe
                        Then look at the R2 outputs from this and from the full model (the second one shown in #11). Subtract. (You are probably most interested in the within or overall R2, less so in the between R2.)

                        Comment


                        • #13
                          Hi all, I have been reading along. If the F-test turns out to be insignificant is it recommended to leave out the time fixed effects?

                          Thank you in advance!

                          Comment


                          • #14
                            That will depend on who you ask.

                            In my opinion, selection of variables in a model should not be based on statistical tests. It should be based on the fit of the model to the data, the theoretical basis for including the variables, and, when possible, the ability of the model to predict results not in the data from which it was derived. Statistical tests play little or no role in any of that.

                            More recently, the American Statistical Association has recommended that the concept of statistical significance as a whole be abandoned. See https://www.tandfonline.com/doi/full...5.2019.1583913, which would apply to this particular application as well.

                            Comment


                            • #15
                              The reduced model contains only the "nuisance" variables, which in your case are the i.year indicators. So run
                              Code:
                              xtreg Z_score i.year, fe
                              Then look at the R2 outputs from this and from the full model (the second one shown in #11). Subtract. (You are probably most interested in the within or overall R2, less so in the between R2.)
                              Thank you very much. It worked perfectly. First I did the Hausman Test to see if I have to use the fixed-effects model and so I'm only interested in the Within R².

                              Code:
                              xtreg Z_score LLR LLP NPA i.year, fe vce(cluster id)
                              
                              Fixed-effects (within) regression               Number of obs     =    172,431
                              Group variable: id                              Number of groups  =     16,208
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.1653                                         min =          1
                                   between = 0.0368                                         avg =       10.6
                                   overall = 0.0833                                         max =         24
                              
                                                                              F(26,16207)       =    1007.76
                              corr(u_i, Xb)  = -0.0624                        Prob > F          =     0.0000
                              
                                                              (Std. Err. adjusted for 16,208 clusters in id)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                   Z_score |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                       LLR |   5.743304   .7524168     7.63   0.000     4.268484    7.218124
                                       LLP |  -.0000905   2.26e-06   -40.01   0.000    -.0000949   -.0000861
                                       NPA |   3.861483   .1238883    31.17   0.000     3.618648    4.104317
                                           |
                                      year |
                                     1996  |   .0011252   .0018337     0.61   0.539     -.002469    .0047194
                                     1997  |  -.0109436   .0023918    -4.58   0.000    -.0156319   -.0062554
                                     1998  |   .0014741   .0027731     0.53   0.595    -.0039615    .0069097
                                     1999  |   .0298605   .0029465    10.13   0.000     .0240851    .0356359
                                     2000  |   .0094353   .0030306     3.11   0.002      .003495    .0153756
                                     2001  |   .0234683   .0030928     7.59   0.000      .017406    .0295306
                                     2002  |   .0019659   .0030866     0.64   0.524    -.0040841    .0080159
                                     2003  |   .0063794   .0032659     1.95   0.051    -.0000221     .012781
                                     2004  |   .0015183   .0034244     0.44   0.657    -.0051938    .0082304
                                     2005  |   -.000328   .0036023    -0.09   0.927     -.007389     .006733
                                     2006  |  -.0185198   .0037269    -4.97   0.000     -.025825   -.0112147
                                     2007  |  -.0325805   .0039415    -8.27   0.000    -.0403063   -.0248548
                                     2008  |   .0235797   .0042141     5.60   0.000     .0153196    .0318397
                                     2009  |   .0513198   .0045123    11.37   0.000     .0424752    .0601643
                                     2010  |   .0143684    .004396     3.27   0.001     .0057517    .0229852
                                     2011  |  -.0244906   .0042772    -5.73   0.000    -.0328744   -.0161068
                                     2012  |   -.027744   .0041473    -6.69   0.000    -.0358732   -.0196149
                                     2013  |   .0094304   .0042133     2.24   0.025     .0011719    .0176889
                                     2014  |  -.0126633   .0041436    -3.06   0.002    -.0207852   -.0045414
                                     2015  |  -.0128751   .0040976    -3.14   0.002    -.0209068   -.0048434
                                     2016  |  -.0038756   .0042183    -0.92   0.358    -.0121439    .0043928
                                     2017  |  -.0094145    .004242    -2.22   0.026    -.0177292   -.0010997
                                     2018  |    -.03078   .0043065    -7.15   0.000    -.0392212   -.0223388
                                           |
                                     _cons |  -1.741384   .0069583  -250.26   0.000    -1.755023   -1.727745
                              -------------+----------------------------------------------------------------
                                   sigma_u |  .28227186
                                   sigma_e |  .19265795
                                       rho |  .68220173   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              Code:
                              xtreg Z_score i.year, fe vce(cluster id)
                              
                              Fixed-effects (within) regression               Number of obs     =    172,431
                              Group variable: id                              Number of groups  =     16,208
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.0384                                         min =          1
                                   between = 0.0003                                         avg =       10.6
                                   overall = 0.0123                                         max =         24
                              
                                                                              F(23,16207)       =     122.17
                              corr(u_i, Xb)  = -0.0284                        Prob > F          =     0.0000
                              
                                                              (Std. Err. adjusted for 16,208 clusters in id)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                   Z_score |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                      year |
                                     1996  |  -.0001402   .0018755    -0.07   0.940    -.0038165     .003536
                                     1997  |   -.014736   .0024287    -6.07   0.000    -.0194965   -.0099755
                                     1998  |   -.003407   .0028025    -1.22   0.224    -.0089002    .0020861
                                     1999  |   .0238641   .0030128     7.92   0.000     .0179587    .0297694
                                     2000  |   .0043351   .0030994     1.40   0.162      -.00174    .0104102
                                     2001  |   .0236945   .0031746     7.46   0.000     .0174719    .0299172
                                     2002  |   .0044319   .0031419     1.41   0.158    -.0017267    .0105904
                                     2003  |   .0066334    .003308     2.01   0.045     .0001493    .0131175
                                     2004  |   -.004639   .0034737    -1.34   0.182    -.0114479    .0021699
                                     2005  |  -.0113147   .0037079    -3.05   0.002    -.0185826   -.0040468
                                     2006  |  -.0294296   .0038122    -7.72   0.000    -.0369019   -.0219573
                                     2007  |  -.0309481   .0039919    -7.75   0.000    -.0387726   -.0231236
                                     2008  |   .0700794   .0044908    15.61   0.000     .0612769    .0788819
                                     2009  |   .1420634   .0052618    27.00   0.000     .1317496    .1523772
                                     2010  |   .1165972   .0050311    23.18   0.000     .1067357    .1264587
                                     2011  |   .0657116   .0047502    13.83   0.000     .0564007    .0750224
                                     2012  |   .0408614   .0043411     9.41   0.000     .0323523    .0493705
                                     2013  |   .0570939   .0043688    13.07   0.000     .0485305    .0656572
                                     2014  |   .0175019   .0042253     4.14   0.000     .0092199    .0257838
                                     2015  |   .0065382   .0041446     1.58   0.115    -.0015857    .0146622
                                     2016  |   .0109244   .0042533     2.57   0.010     .0025876    .0192613
                                     2017  |  -.0001428   .0042102    -0.03   0.973    -.0083952    .0081097
                                     2018  |  -.0230611   .0043009    -5.36   0.000    -.0314913   -.0146309
                                           |
                                     _cons |  -1.659507   .0024727  -671.13   0.000    -1.664354   -1.654661
                              -------------+----------------------------------------------------------------
                                   sigma_u |  .28762961
                                   sigma_e |  .20677701
                                       rho |  .65927505   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              I calculated the R² by R²full model - R²reduced model with my calculator but unfortunatly not with Stata. I know that the command
                              Code:
                              xtreg, fe
                              stores the results in
                              Code:
                              e()
                              and that the Within R² model is e(r2_w). I also installed the
                              Code:
                              ssc inst regsave
                              command.
                              How can I only save the Within R²full model and R²reduced model results in my current (active) Stata Data Set and calculate the difference in Stata and save the result R² as well in my Stata data set?
                              Actually I have four bank risk proxies (Z_score, NPA, LLR, LLP) and for each I would like to calculate the R².
                              Code:
                              xtreg NPA Z_score LLR LLP i.year, fe vce(cluster id)
                              xtreg Z_score i.year, fe vce(cluster id)
                              Finally I would like to show in one graph the four R² values (for each risk proxy) from regeressions in which we explain one risk proxy k = 1, ..., 4 with the remaining j proxies.

                              Risk Proxykit = j not=k, it ß + eit

                              Thank you very much!
                              Last edited by Katharina Maier; 13 Jun 2019, 09:46.

                              Comment

                              Working...
                              X