Announcement

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

  • Fixed-effects regression with heterocedastic and autocorrelation [PANEL DATA]

    I have panel data with T=30 (years) and N=26 (states of a country). My coefficients are all significant (with xtreg, fe), but heteroscedastic and autocorrelation. I've tried using [xtreg, robust] and my coefficients remain significant. When I used Driscoll-Kraay standard errors ( xtscc, fe), all my coefficients lost significance. Considering the size of my panel, do I really need to use Driscoll-Kraay standard errors? Which estimator should I use?

    Heeeeeeelp me!

  • #2
    Silas:
    welcome to this forum.
    Please read the FAQ on how to post more effectively (which does not include crying for heeeeelp!).
    That said, since you have a T>N panel dataset, you may want to consider -xtregar- and -xtgls-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      I have an dynamic panel model:

      i,t = a0 + a1Pi + a2At + a3Yi,t-1 + a4Xi,t + ei,t where country i = 1,2, ..., 22 and year t = 1970,1971,..., 2020.

      P is a country fixed effect and A is a time fixed effect.

      Can I use xtregar or xtgls or xtabond?

      And If my panel is unbalanced?

      Regards,

      Sebastian.

      Comment


      • #4
        T/N does not tend to infinity in your case, your model is prone to the Nickell bias (1981). Your coefficient a3 will suffer from a heavy bias unless you use a generalised method of moments estimation, I suggest Sebastian Kripfganz's xtdpdgmm.

        Should your model be dynamic? If not, I would use xtscc (Hoechle, 2007): if your coefficients became significant after using that command, this means other standard errors were too optimistic and not robust to certain Gauss-Markov assumption violations in your data.

        Hope this helps,
        Maxence

        Comment


        • #5
          Sebastian:
          as an aside to Maxence's helpful recommendations, if you're dealing with a dynamic panel data regression, -xtregar- and -xtgls- are out of debate.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Dear Maxence and Carlo,

            Next an example of my data:

            Code:
            * Example generated by -dataex-. For more info, type help dataex
            clear
            input double co2pc float ei double res_share float gdppc double URB long pais float year
            3286.2147819625325 1.3754655  7.709124606047121 16043666  78.70199774896942 1 1970
             3431.236895222778 1.4175532 7.0252528343576035 16686610  79.18215644568501 1 1971
             3419.874882656064 1.4499425  6.440856539585154 16687580  79.58915868218907 1 1972
            3543.3444355322176 1.5010184  6.250197582794806 16880642  79.99620329642086 1 1973
             3340.517628680062 1.4807127 6.2682545487921555 17252484  80.81140608777491 1 1975
            3433.8755341643173 1.5891156  5.818029016156285 16647546  81.22012353144147 1 1976
            3528.9769972382505  1.569135  6.269955537803029 17537022  81.62947313087034 1 1977
            3478.8388622988623 1.7507004  8.650819515892865 17909432  82.85573667739273 1 1980
            3300.7680005009056  1.923844   9.78930423769241 16767346  84.04981228570371 1 1983
            2934.0805944666895 2.1091933 10.376461253161487 15637067  84.84290581185955 1 1985
              3122.23060789614 1.9985754  9.801741388220577 16338281  85.23965137456473 1 1986
              3083.14814975348 2.3405354  9.544988414512808 16209323             87.542 1 1992
             3147.360211468547 2.2168443  10.53164462652347 17312030             87.752 1 1993
             3319.985887377269  2.303748  9.797564549518539 18104698             88.366 1 1996
            3304.5843308712447  2.691475 10.170165512804576 17610752             89.329 1 2001
            3651.4928625726984  2.724571  8.833553660790352 19426436             90.031 1 2005
             3810.264909826442  2.697558  8.940565296669032 20777652  90.20000000000002 1 2006
             4355.093244030883  2.378658 10.717426692686459 24612430              90.99 1 2011
             4233.922757918742  2.583353 11.661660055419597 23654944             91.749 1 2017
            3874.1447456663254  2.707274 11.411918067247381 22143974             91.991 1 2019
             612.7542177972102 .16914704    36.336928681029  5544146             40.389 4 1972
             667.1287286067575  .1706408  35.16319985837973  5774558             40.696 4 1973
             792.5181992322482 .20355673  31.45693241142998  6187976  41.31399999999999 4 1975
             852.7795932729962  .2154245 31.114588570173346  6376695             41.624 4 1976
             962.1428546817162 .32887655 39.865893945445244  6093886             46.459 4 1981
              858.898173700765   .365507  47.49869127564178  5387883             48.486 4 1983
             824.5555057872042   .382402  46.32638676821423  5265624 49.503999999999984 4 1984
             774.9070068304826  .3986695  46.48503911776398  5070400 50.519000000000005 4 1985
              807.357197941389  .3839506  39.50975434172822  4854903             52.549 4 1987
             836.8803457473597  .4768258  39.03234247864291  4703656             55.577 4 1990
             830.9961156771793  .4782825 40.102592182667266  4837942             56.579 4 1991
             847.1167609025041  .4926911  37.47978453715693  4803453             57.548 4 1992
             919.0779458482207  .5338558  33.24129248615289  5003539  58.78499999999999 4 1994
             995.5275898996018  .5717148  30.31953546759722  5120811               59.4 4 1995
              902.288362859519  .6938182  24.09170339042408  5227686  59.89099999999999 4 1996
             888.7915011010407  .7268228 22.417652515012463  5368819  60.38000000000001 4 1997
             915.8026951112445  .7084662 21.688316985967592  5519755  60.86600000000001 4 1998
             922.7124653194431  .6235418 26.468578294416623  5428509  61.35099999999999 4 1999
             872.0841664885021  .4857451  25.11312617756083  5409409  61.79050296306087 4 2000
             835.8374810044038 .52472687 24.244551611125313  5397838  62.32051064109676 4 2001
             883.7085958836591  .6322722 20.475480174042175  5430654  62.81044350207748 4 2002
             953.6147076065972  .6326885 19.556804605523812  5477542   63.3196012413805 4 2003
            1031.2258969674394  .6320002 19.723760951038923  5605298  63.82517913803575 4 2004
            1100.2636111000131  .6858968  17.72925090964664  5751492  64.32713500613816 4 2005
            1375.3419940611618  .6443027 18.429902594588164  6358748  65.80875872231398 4 2008
            1701.0303846484153  .6921701 14.830724870259127  7099556  67.72162055121713 4 2012
            1923.5972390478066  .7086779 13.834766378919003  8017397  69.10356882282697 4 2015
            2004.3614719118175  .6959532 12.680457413425792  8459282  69.99773271716234 4 2017
            1081.0681356459331  7.367412  51.03186634700295  8142455 57.365168288719715 5 1973
            1453.4512397768442  7.762915 44.124294004800205 10416959   65.9701721607012 5 1979
            1205.6248434807887  8.933547 51.990982764937755  9707633  69.68947899339658 5 1983
            1181.0160641102398  9.502618  53.80536674468275 10005020  70.41099621368076 5 1984
            1247.5606014879295  9.386317 53.165288103746214 10559846    71.132541402967 5 1985
            1373.9197568557267  9.096543  50.04816702230921 11117792  71.85410926078546 5 1986
            1379.7989238682594  9.337251  51.17660701145482 11282916  72.57572385759636 5 1987
            1384.3410022008468 10.367065  48.99978796017337 10520744  74.74085714837145 5 1990
            1404.9769899052312  10.47708 48.456518009667334 10443959  75.47798530395424 5 1991
             1421.392993627697 10.509623 46.540613033406636 10537274  76.74080096719348 5 1993
            1470.1999745858675   10.4213  46.59174754309925 10973254  77.37213267782158 5 1994
            1666.8038629610987 10.659055 43.347312378960375 11321390  78.63467394853629 5 1996
             1712.634426526716 10.504567    43.206414611395 11524112  79.26589059180846 5 1997
            1732.3807573199258 11.027717 42.092246886678645 11387624   79.8970883423061 5 1998
             1618.670071719241 12.195905 39.205840030095686 11602500  81.50274308879142 5 2001
             1689.105357444527 11.773958  41.06822587763326 11800842  81.81895413779282 5 2002
             1624.696946031232   12.2943 44.328610603061506 11786334  82.13516520107387 5 2003
            1801.1314156331925 12.598016  47.02815845121597 13564995  83.40000974588907 5 2007
            1917.1906291544667  12.67138  46.85460724044686 14114975  83.71622365187301 5 2008
            2442.8873657240415 13.272405  40.33969070298837 15749513  85.45042048903179 5 2014
            2183.8207209870275 13.600372 43.570573901024446 14524614  86.21479578765553 5 2017
              2129.74301956181  13.55781  46.21410000960188 14668256  86.45849602954098 5 2018
              2134.53981564693 13.624445  46.53725020961698 14763872  86.82399999999998 5 2019
            2531.3151038322712  .7447839 18.630257705927846  8953570   72.8984516127144 6 1971
             2298.524628973366  .8192898  21.36632749886659  8163481   74.8404702312498 6 1974
             1988.687651300057  .8654773  23.59140165219142  7137172  76.12435739723267 6 1976
            2162.5316347697394  .7080221 24.388621192098082  9775461  79.31006248094036 6 1981
            1845.2710896624235  .6862119  27.75462551792983  8559369  79.85427679261147 6 1982
             1847.322294190408   .803075 29.516919404934782  7998062  80.01456284925452 6 1983
            1937.3382715974853  .8321856   29.6950207633555  8189749  80.17461720799021 6 1984
             1907.589571730702  .8184485 32.171068699038166  9072646   80.6559990170441 6 1987
             2203.831973576121   .887623 28.746034740646877  9566640  80.81629632090814 6 1988
             2537.764935385427  .9506112 26.091619803241723 10394012  81.15309966455571 6 1990
            2417.5093467275046  .8820636 32.342525914865746 11988517  81.50995701055183 6 1992
            3280.6508400710372   .901462  26.64444787590327 14552562  82.90280462676841 6 1996
             3643.632483678783  .9568218   24.7855972100249 15403951  83.24449116657996 6 1997
            3796.0688694331693 1.1187783  21.57179101289471 15570677   83.9229401907434 6 1999
            3441.2200847430468 1.1352817 24.841863598136243 16519501  84.59632832545223 6 2001
            3451.8273554498915 1.1183531 24.844904460975524 16905378  84.90145204059871 6 2002
            3521.5382817683417 1.1273509  23.53249995853021 17317512  85.12060556921305 6 2003
            3854.4608802927155   1.10895  22.80692608369761 18358066  85.32894331556619 6 2004
            3930.6322826518362  1.072669  24.12553645620465 19312390  85.52440980700675 6 2005
             5002.608064157746  .8893799 24.170887221642314 24112466  86.88445371020143 6 2012
             4741.512633938612  .8580325 25.686142466098588 25059240  87.24642430124464 6 2014
             4748.608057292003  .9930218 27.020630456261035 24967576  87.64299999999999 6 2019
            1191.5900168849662 1.9408194  31.50323182705629  5827135  59.64748971284751 7 1972
            1272.8750907075494 1.8165045  24.83955923008545  6290695   61.2659444292588 7 1974
            1328.0810649849457  1.961482 32.224469530788255  6448158  62.32729721794135 7 1976
             1363.896385472774  1.889202 31.565637123158396  7179633 63.919042692907425 7 1979
            1329.2160880780093 1.8898102   32.7248787533593  7309877  64.44998510358828 7 1980
            1329.5853119183037 2.0700948 32.394989454748334  7224587  65.51247470080429 7 1982
            1335.2180330765555  2.301859 31.140045562056844  7266291  66.57538283957571 7 1984
            end
            label values pais pais
            label def pais 1 "Argentina", modify
            label def pais 4 "Bolivia", modify
            label def pais 5 "Brasil", modify
            label def pais 6 "Chile", modify
            label def pais 7 "Colombia", modify
            Next I show my model showing used vars:

            CO2 pc emissions growth = Constant + Time-fixed effect + Country-fixed effect + a1*Lag-CO2 pc emissions + a2*GDPpc growth + a3*EI change + a4*REShare change + a5*Urban change + error

            Code to generate variables:

            Code:
            xtset pais year
            
            *CO2 pc emissions growth
            gen ln_co2pc = ln(co2pc)
            gen ln_co2pc_gr = d.ln_co2pc
            
            *Lag-CO2 pc emissions
            gen ln_co2pc_1 = l.ln_co2pc
            
            *GDPpc growth
            gen ln_gdpppc = ln(gdppc)
            gen ln_gdpppc_gr = d.ln_gdpppc
            
            *EI change
            gen ei_ch = d.ei
            
            REShare change
            gen res_share_ch = d.res_share
            
            *Urban change
            gen URB_ch = d.URB
            I have to use a dynamic panel model because of theory, empirical evidence and Lag-CO2 pc emissions are very significative to explain CO2 pc emissions:

            Code:
            . reg co2pc l.co2pc
            
                  Source |       SS           df       MS      Number of obs   =     1,100
            -------------+----------------------------------   F(1, 1098)      >  99999.00
                   Model |  1.2606e+10         1  1.2606e+10   Prob > F        =    0.0000
                Residual |   103008868     1,098  93814.9985   R-squared       =    0.9919
            -------------+----------------------------------   Adj R-squared   =    0.9919
                   Total |  1.2709e+10     1,099  11563932.1   Root MSE        =    306.29
            
            ------------------------------------------------------------------------------
                   co2pc | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   co2pc |
                     L1. |   1.007336   .0027481   366.56   0.000     1.001944    1.012728
                         |
                   _cons |   7.941047   11.26107     0.71   0.481    -14.15459    30.03669
            ------------------------------------------------------------------------------
            
            . xtreg co2pc l.co2pc
            
            Random-effects GLS regression                   Number of obs     =      1,100
            Group variable: pais                            Number of groups  =         22
            
            R-squared:                                      Obs per group:
                 Within  = 0.9695                                         min =         50
                 Between = 0.9999                                         avg =       50.0
                 Overall = 0.9919                                         max =         50
            
                                                            Wald chi2(1)      =  134368.20
            corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                   co2pc | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   co2pc |
                     L1. |   1.007336   .0027481   366.56   0.000      1.00195    1.012722
                         |
                   _cons |   7.941047   11.26107     0.71   0.481    -14.13024    30.01233
            -------------+----------------------------------------------------------------
                 sigma_u |          0
                 sigma_e |  303.45357
                     rho |          0   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . areg co2pc l.co2pc, abs(pais)
            
            Linear regression, absorbing indicators           Number of obs     =    1,100
            Absorbed variable: pais                           No. of categories =       22
                                                              F(1, 1077)        = 34233.63
                                                              Prob > F          =   0.0000
                                                              R-squared         =   0.9922
                                                              Adj R-squared     =   0.9920
                                                              Root MSE          = 303.4536
            
            ------------------------------------------------------------------------------
                   co2pc | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   co2pc |
                     L1. |   .9818807   .0053068   185.02   0.000     .9714678    .9922935
                         |
                   _cons |   67.63114   15.44564     4.38   0.000      37.3242    97.93809
            ------------------------------------------------------------------------------
            F test of absorbed indicators: F(21, 1077) = 1.983            Prob > F = 0.005
            
            . xtgls co2pc l.co2pc
            
            Cross-sectional time-series FGLS regression
            
            Coefficients:  generalized least squares
            Panels:        homoskedastic
            Correlation:   no autocorrelation
            
            Estimated covariances      =         1          Number of obs     =      1,100
            Estimated autocorrelations =         0          Number of groups  =         22
            Estimated coefficients     =         2          Time periods      =         50
                                                            Wald chi2(1)      =  134612.95
            Log likelihood             = -7856.825          Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                   co2pc | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   co2pc |
                     L1. |   1.007336   .0027456   366.90   0.000     1.001954    1.012717
                         |
                   _cons |   7.941047   11.25082     0.71   0.480    -14.11016    29.99226
            ------------------------------------------------------------------------------
            
            . xtgls co2pc l.co2pc, panels(correlated)
            
            Cross-sectional time-series FGLS regression
            
            Coefficients:  generalized least squares
            Panels:        heteroskedastic with cross-sectional correlation
            Correlation:   no autocorrelation
            
            Estimated covariances      =       253          Number of obs     =      1,100
            Estimated autocorrelations =         0          Number of groups  =         22
            Estimated coefficients     =         2          Time periods      =         50
                                                            Wald chi2(1)      =  111601.74
                                                            Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                   co2pc | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   co2pc |
                     L1. |   1.003795   .0030048   334.07   0.000     .9979057    1.009684
                         |
                   _cons |   6.313436   2.818606     2.24   0.025     .7890696     11.8378
            ------------------------------------------------------------------------------
            What do you think?

            Greetings,

            Sebastian.

            Comment


            • #7
              Ok then in that case I would definitely go for Kripfganz's (2017) xtdpdgmm command due to T/N in your case being quite far from infinity and the resulting Nickell bias.

              Comment


              • #8
                Sebastian:
                as an aside to Maxence's helpful lead, you may want to take a look at the recent and valuable https://www.stata.com/bookstore/envi...cs-using-stata
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Carlo and Maxence: Thanks for the advice!

                  Comment


                  • #10
                    Carlo: Do you think clustering (by id_location) would be a viable solution? Or would I really have to use -xtregar, fe?

                    Comment


                    • #11
                      Originally posted by Carlo Lazzaro View Post
                      Sebastian:
                      as an aside to Maxence's helpful lead, you may want to take a look at the recent and valuable https://www.stata.com/bookstore/envi...cs-using-stata
                      Carlo, I read it. It is a very good book. Thanks!

                      Comment


                      • #12
                        Originally posted by Maxence Morlet View Post
                        Ok then in that case I would definitely go for Kripfganz's (2017) xtdpdgmm command due to T/N in your case being quite far from infinity and the resulting Nickell bias.
                        Maxence,

                        I would try it!

                        Thanks!

                        Comment

                        Working...
                        X