Announcement

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

  • Panel Data: Time Fixed Effects? TestParm...

    Hello,

    I'm running a panel data on 6 nations to analyze how structural characteristics affect gov budget components.

    I've found that after running the Hausman test, that FE is preferred.

    (1) I checked for time-fixed effects, and it turned out significant, hence I ran FE again with robust standard errors and ran the TESTPARM again and it's still there.. What should I do?


    . xtreg compensation loggdp loggdpcap depend open popdens oilrents i.time, fe

    Fixed-effects (within) regression Number of obs = 66
    Group variable: countrynum Number of groups = 5

    R-sq: within = 0.6184 Obs per group: min = 10
    between = 0.0336 avg = 13.2
    overall = 0.0157 max = 15

    F(20,41) = 3.32
    corr(u_i, Xb) = -0.9901 Prob > F = 0.0006

    ------------------------------------------------------------------------------
    compensation | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    loggdp | 5.936893 7.980265 0.74 0.461 -10.17958 22.05336
    loggdpcap | -29.00649 10.11438 -2.87 0.007 -49.43289 -8.580081
    depend | .1813371 .0776225 2.34 0.024 .0245753 .3380989
    open | .0264436 .0392724 0.67 0.505 -.0528687 .1057559
    popdens | -.0597901 .0290672 -2.06 0.046 -.1184925 -.0010877
    oilrents | -.1078702 .0494338 -2.18 0.035 -.2077038 -.0080365
    |
    time |
    2 | 1.475155 .8063946 1.83 0.075 -.1533922 3.103702
    3 | 1.803126 .8851192 2.04 0.048 .0155918 3.590661
    4 | 2.629039 .9398327 2.80 0.008 .7310085 4.52707
    5 | 3.242708 1.032514 3.14 0.003 1.157503 5.327912
    6 | 4.392323 1.176661 3.73 0.001 2.016009 6.768637
    7 | 5.049528 1.357306 3.72 0.001 2.308392 7.790664
    8 | 5.27229 1.478431 3.57 0.001 2.286538 8.258042
    9 | 6.387174 1.556374 4.10 0.000 3.244012 9.530336
    10 | 6.46084 1.548937 4.17 0.000 3.332699 9.588981
    11 | 6.8555 1.524781 4.50 0.000 3.776142 9.934858
    12 | 8.015308 1.601325 5.01 0.000 4.781367 11.24925
    13 | 7.607703 1.743455 4.36 0.000 4.086724 11.12868
    14 | 7.670823 1.794717 4.27 0.000 4.046317 11.29533
    15 | 8.212025 1.811259 4.53 0.000 4.554114 11.86994
    |
    _cons | 49.64063 62.6624 0.79 0.433 -76.90866 176.1899
    -------------+----------------------------------------------------------------
    sigma_u | 20.537813
    sigma_e | 1.0744317
    rho | .99727063 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4, 41) = 7.45 Prob > F = 0.0001

    . testparm i. time

    ( 1) 2.time = 0
    ( 2) 3.time = 0
    ( 3) 4.time = 0
    ( 4) 5.time = 0
    ( 5) 6.time = 0
    ( 6) 7.time = 0
    ( 7) 8.time = 0
    ( 8) 9.time = 0
    ( 9) 10.time = 0
    (10) 11.time = 0
    (11) 12.time = 0
    (12) 13.time = 0
    (13) 14.time = 0
    (14) 15.time = 0

    F( 14, 41) = 2.26
    Prob > F = 0.0215


    ================================================== ===



    . xtreg compensation loggdp loggdpcap depend open popdens oilrents i.time, fe vce(robust)

    Fixed-effects (within) regression Number of obs = 66
    Group variable: countrynum Number of groups = 5

    R-sq: within = 0.6184 Obs per group: min = 10
    between = 0.0336 avg = 13.2
    overall = 0.0157 max = 15

    F(4,4) = .
    corr(u_i, Xb) = -0.9901 Prob > F = .

    (Std. Err. adjusted for 5 clusters in countrynum)
    ------------------------------------------------------------------------------
    | Robust
    compensation | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    loggdp | 5.936893 7.822397 0.76 0.490 -15.78156 27.65535
    loggdpcap | -29.00649 8.733987 -3.32 0.029 -53.25592 -4.757052
    depend | .1813371 .1339092 1.35 0.247 -.1904544 .5531285
    open | .0264436 .0471894 0.56 0.605 -.1045751 .1574623
    popdens | -.0597901 .0361108 -1.66 0.173 -.1600498 .0404697
    oilrents | -.1078702 .0312756 -3.45 0.026 -.1947051 -.0210352
    |
    time |
    2 | 1.475155 1.085362 1.36 0.246 -1.538293 4.488602
    3 | 1.803126 .8407005 2.14 0.099 -.5310323 4.137285
    4 | 2.629039 1.015436 2.59 0.061 -.1902639 5.448342
    5 | 3.242708 1.012003 3.20 0.033 .4329366 6.052479
    6 | 4.392323 1.311021 3.35 0.029 .7523444 8.032302
    7 | 5.049528 1.60214 3.15 0.034 .6012743 9.497781
    8 | 5.27229 1.668428 3.16 0.034 .6399925 9.904588
    9 | 6.387174 1.821449 3.51 0.025 1.330022 11.44433
    10 | 6.46084 1.969247 3.28 0.030 .9933339 11.92835
    11 | 6.8555 1.806006 3.80 0.019 1.841223 11.86978
    12 | 8.015308 1.990894 4.03 0.016 2.487699 13.54292
    13 | 7.607703 1.336088 5.69 0.005 3.898128 11.31728
    14 | 7.670823 1.475115 5.20 0.007 3.575246 11.7664
    15 | 8.212025 1.775552 4.63 0.010 3.282301 13.14175
    |
    _cons | 49.64063 69.88321 0.71 0.517 -144.3863 243.6675
    -------------+----------------------------------------------------------------
    sigma_u | 20.537813
    sigma_e | 1.0744317
    rho | .99727063 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------

    . testparm i.time

    ( 1) 2.time = 0
    ( 2) 3.time = 0
    ( 3) 4.time = 0
    ( 4) 5.time = 0
    ( 5) 6.time = 0
    ( 6) 7.time = 0
    ( 7) 8.time = 0
    ( 8) 9.time = 0
    ( 9) 10.time = 0
    (10) 11.time = 0
    (11) 12.time = 0
    (12) 13.time = 0
    (13) 14.time = 0
    (14) 15.time = 0
    Constraint 2 dropped
    Constraint 3 dropped
    Constraint 4 dropped
    Constraint 5 dropped
    Constraint 7 dropped
    Constraint 8 dropped
    Constraint 9 dropped
    Constraint 10 dropped
    Constraint 12 dropped
    Constraint 13 dropped

    F( 4, 4) = 13.64
    Prob > F = 0.0134

    --------------------------------------------------------------------------

    (2) When running further tests (xttset2, xttset3, and xtserial) should I run robust standard errors? or test on the normal errors? or include the time dummy variables? I'm very confused.

    Thanks, any input would be appreciated.

  • #2
    With only 5 clusters, you should not use clustered (robust) standard errors. While there is disagreement among statisticians as to the minimum number of clusters needed before cluster robust standard errors become valid, I'm pretty sure everyone would agree that 5 is too few.

    I'm not sure what other question you are asking. You seem surprised that you found statistically significant effects for your time indicators. In economic problems that is quite often the case, so I'm wondering what it is that surprises you about this.

    Added: It is odd that you say you have 6 countries, but Stata only finds 5 clusters when you run -xtreg-. Either one country has no observations with complete data on all variables in the model, or you made a typo in your post here, or you have somehow managed to drop one country's data before you got to the regression. Something is definitely amiss.

    And when you say "it's still there," what does "it" refer to?

    Comment


    • #3
      Thanks for replying: Noted that 5 is too few, so will go back to using robust.

      6 was a typo.

      I was not sure how to interpret the results I posted for testparm, whats the next step should I report those? what does it mean that time fixed effects are needed?




      Comment


      • #4
        Thanks for replying: Noted that 5 is too few, so will go back to using robust.
        Huh? No. With -xtreg-, -vce(robust)- is automatically changed by Stata to -vce(cluster panelvar)-, where panelvar is the panel variable you specified in -xtset-. So you have to go back to the ordinary normal-theory VCE. No robust. No clutser.

        The fact that you have large time effects just means that there are important year-by-year shocks to your outcome variable that should not be ignored. In fact, in your results it appears that some of these year by year shocks are among the biggest determinants of the outcome. I'm not an economist, but my understanding is that this is very common in economic analysis. It's precisely the reason most economic analyses do include time variables.

        Anyhow, they need to be included in your model. As for what it means, that's not a statistical question and you would need to ask an economist. (There are a number of economists in the Forum community, and perhaps one of them will chime in with an explanation that is appropriate to this context.)

        Comment


        • #5
          Nova:
          -testparm- outcome means that you shoud keep -i.time- i your regression. Clyde offered an excellen explanation about that (things changes within panels as years go by). Obviously, you have to check this result wit the literature on your research field. I do not know to which nations and period your dataset refers to but, if recent, I would have expected to find out some clues concerning the sluggish economy of the last years;
          - but the main concern I have is that you seemingly tested -fe- vs -re- via -hausman- (with default standard errors, as manadatorily so) and then you re-ran -xtreg, fe- with clustered/robust standard errors. That's no correct: if you suspect your dataset suffers from heteroskedasticity and/or autocorrelation, you should impose clustered/robust standard errors first, and test -fe- vs -re- specification via the user-written programme -xtoverid- (type -search xtoverid- from within Stata to install it). Maybe -fe- will still outperforms -re-, but I would follow the right approach.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Hi Carlo, great advice thanks. I worked on increasing my data points from 5 countries to 14 countries (time span 16 years) and did what you say.

            Code:
            . xi: xtreg compensation loggdp loggdpcap dependency openess popdens oilrents i.time, fe robust
            i.time            _Itime_1-16         (naturally coded; _Itime_1 omitted)
            
            Fixed-effects (within) regression               Number of obs      =       199
            Group variable: countrynum                      Number of groups   =        14
            
            R-sq:  within  = 0.5683                         Obs per group: min =         8
                   between = 0.0726                                        avg =      14.2
                   overall = 0.0609                                        max =        16
            
                                                            F(13,13)           =         .
            corr(u_i, Xb)  = -0.9774                        Prob > F           =         .
            
                                        (Std. Err. adjusted for 14 clusters in countrynum)
            ------------------------------------------------------------------------------
                         |               Robust
            compensation |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  loggdp |  -5.589439   2.009031    -2.78   0.016    -9.929687   -1.249192
               loggdpcap |  -6.227412   2.492145    -2.50   0.027    -11.61136   -.8434598
              dependency |   .0243722   .0213499     1.14   0.274    -.0217515     .070496
                 openess |  -.0420133   .0133059    -3.16   0.008    -.0707591   -.0132676
                 popdens |  -.0568532   .0117899    -4.82   0.000    -.0823237   -.0313826
                oilrents |  -.1162708   .0311822    -3.73   0.003    -.1836359   -.0489057
                _Itime_2 |  -.0654013   .3899331    -0.17   0.869    -.9078005     .776998
                _Itime_3 |   .0251174   .3496168     0.07   0.944    -.7301837    .7804185
                _Itime_4 |   .3283427   .2894861     1.13   0.277     -.297054    .9537395
                _Itime_5 |   .0091411   .3976874     0.02   0.982    -.8500104    .8682926
                _Itime_6 |   .7741659   .4186445     1.85   0.087    -.1302606    1.678592
                _Itime_7 |   1.030284    .449553     2.29   0.039     .0590837    2.001484
                _Itime_8 |   1.201199   .5322096     2.26   0.042     .0514305    2.350968
                _Itime_9 |   1.522054   .6038802     2.52   0.026     .2174497    2.826658
               _Itime_10 |   1.985241   .6989396     2.84   0.014     .4752735    3.495208
               _Itime_11 |   2.750247   .8843531     3.11   0.008     .8397188    4.660776
               _Itime_12 |    2.96752   .9239178     3.21   0.007     .9715168    4.963523
               _Itime_13 |   3.160279    1.05334     3.00   0.010     .8846767    5.435881
               _Itime_14 |   3.509929   1.041013     3.37   0.005     1.260956    5.758902
               _Itime_15 |   3.235115   .9452563     3.42   0.005     1.193013    5.277217
               _Itime_16 |   3.705286   1.073299     3.45   0.004     1.386565    6.024006
                   _cons |   91.02186   26.94179     3.38   0.005     32.81767    149.2261
            -------------+----------------------------------------------------------------
                 sigma_u |  14.056173
                 sigma_e |   .8326573
                     rho |  .99650315   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . estimate store fe
            
            . xi: xtreg compensation loggdp loggdpcap dependency openess popdens oilrents i.time, re robust
            i.time            _Itime_1-16         (naturally coded; _Itime_1 omitted)
            
            Random-effects GLS regression                   Number of obs      =       199
            Group variable: countrynum                      Number of groups   =        14
            
            R-sq:  within  = 0.4698                         Obs per group: min =         8
                   between = 0.2169                                        avg =      14.2
                   overall = 0.2646                                        max =        16
            
                                                            Wald chi2(13)      =         .
            corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =         .
            
                                        (Std. Err. adjusted for 14 clusters in countrynum)
            ------------------------------------------------------------------------------
                         |               Robust
            compensation |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  loggdp |   -4.00618   1.034916    -3.87   0.000    -6.034579   -1.977782
               loggdpcap |   1.376333   .7593522     1.81   0.070    -.1119703    2.864636
              dependency |   .0350143   .0199233     1.76   0.079    -.0040346    .0740632
                 openess |  -.0192224   .0149172    -1.29   0.198    -.0484596    .0100148
                 popdens |  -.0068258   .0059749    -1.14   0.253    -.0185363    .0048847
                oilrents |  -.1288184   .0512686    -2.51   0.012     -.229303   -.0283337
                _Itime_2 |  -.1414773   .3497348    -0.40   0.686    -.8269448    .5439903
                _Itime_3 |  -.1368518   .3655458    -0.37   0.708    -.8533085    .5796048
                _Itime_4 |   .0838416   .3826033     0.22   0.827     -.666047    .8337303
                _Itime_5 |  -.3683625   .5228251    -0.70   0.481    -1.393081    .6563558
                _Itime_6 |    .344776   .4228496     0.82   0.415    -.4839939    1.173546
                _Itime_7 |   .5916626   .4093108     1.45   0.148    -.2105718    1.393897
                _Itime_8 |   .7612707   .5065137     1.50   0.133    -.2314778    1.754019
                _Itime_9 |   .9466426   .5956212     1.59   0.112    -.2207535    2.114039
               _Itime_10 |   1.190443   .5531042     2.15   0.031     .1063783    2.274507
               _Itime_11 |    1.73577   .6345704     2.74   0.006     .4920344    2.979505
               _Itime_12 |   1.740693   .5906573     2.95   0.003     .5830263     2.89836
               _Itime_13 |   1.672435   .5779866     2.89   0.004     .5396024    2.805268
               _Itime_14 |   1.820326   .5049573     3.60   0.000     .8306275    2.810024
               _Itime_15 |    1.63635   .6073634     2.69   0.007     .4459395     2.82676
               _Itime_16 |   1.933428   .5600209     3.45   0.001     .8358076    3.031049
                   _cons |   49.69298     13.067     3.80   0.000     24.08214    75.30383
            -------------+----------------------------------------------------------------
                 sigma_u |  1.8249122
                 sigma_e |   .8326573
                     rho |  .82768808   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . estimate store re
            
            . xtoverid
            
            Test of overidentifying restrictions: fixed vs random effects
            Cross-section time-series model: xtreg re  robust cluster(countrynum)
            Sargan-Hansen statistic 687.016  Chi-sq(10)   P-value = 0.0000
            The question is: should I re-test for hetroskadecity, serial correlation, and cross-sectional dependence (pasaran or breush-pagan lm test, what do you advise?)

            If I find serial correlation and hetroskadecity? What should I do next?

            Comment


            • #7
              Nova:
              - get rid of -xi- prefix redundant in most cases and old-fashioned; go -fvvarlist- instead;
              - go:
              Code:
              xtreg compensation loggdp loggdpcap dependency openess popdens oilrents i.time, fe robust
              - wih a large N, (quite) small T, robust/cluster standard errors accomodate for both heteroskedasticity and/or serial correlation.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Ok so just keep it like the code you highlighted?

                Are there any further tests I should do? Or would this robust/cluster be ok?

                How about co-integration/unit root tests? Should I attempt that for my panel data or is it only for time series?

                Thanks so much Carlo, I can't thank you enough.

                Comment


                • #9
                  Nova:
                  - cluster/robust SEs are OK;
                  - no other tests are required (except -xtunitroot- if it matches your case).
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    Thanks Carlos, my T=16 and n=14 and apparently my data is unbalanced hence I can only use Fisher-type or Hadri-LM Test? What do you advise?

                    Should I also specify anything? as in lags? substract cross sectional means? allow for cross-sectional dependence? I tried going through the unitroot help file but it confused me further.

                    Also another question, would a simple VAR model, and Granger causality be sufficient? If the variables are co-integrated then should I just keep it to that?

                    Comment

                    Working...
                    X