Announcement

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

  • Panel Data Fixed Effect - Autocorrelation Problem

    Hello,
    I am working with panel Data, where t=6 and i= 550 and Stata IC16.
    I have run a fixed effects regression -xtreg, fe - and afterwards regressed the residuals on the residuals of the prior period.

    [predict residuals][/regress residuals l.residuals]

    The result is a= 0,69 and T statistics = 47,36 which indicates strong positive serial correlation AR(1).

    Question I: If I apply the Woolridge Test and use the same command, except xtserial instead of xtreg,

    [xtserial math4 aexpp lunch enrollment y95 y96 y97 y98]

    it indicates no serial correlation. Is this because I can not specify that I am using a fixed effects model, and is there an additional test that I can run?


    Question II: What is the best option to control for Serial Correlation AR(1) ?
    I have tried vce (cluster id), xtregar, and xtscc but I am really unsure which gives me the right result.

    I really would appreciate some help,
    thank you!

    Ps. : I really try to improve the way I am asking questions by using the # command - but unfortunately it doesn't highlight my Stata code..

  • #2
    Lea:
    just go -xtreg,fe vce(cluster panelid)-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo:

      Thank you very much for your answer!

      Could you also answer the first question please? Is the residual regression sufficient or do I need to run a specific test in order to prove AR(1) Serial Correlation in my fixed effect regression?

      Comment


      • #4
        Lea:
        Code:
        corr res L.res
        High correlation values show the residuals are not independent.
        See -help corrgram- for ad hoc test on AR(1) process.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          See also "Testing for serial correlation in fixed-effects panel models" https://www.stata-journal.com/articl...article=st0514

          Comment


          • #6
            Hello everyone, I came across this post because I have a similar problem. I use -xtreg- with fixed effects and time fixed effects and have autocorrelation and heteroskedasticity. I actually wanted to use vce(robust), but with vce(cluster gvkey) the regression works exactly the same.
            My question is to know if this command with vce can only fix heteroskedasticity, or if it also helps against autocorrelation? My supervisor for the masters thesis doesn't know much about this unfortunately, but said that he thinks you have to change the regression to a different type to fix autocorrelation.
            It would help me a lot if you guys could help me! If anyone has another good paper I could cite, I would be very happy.

            Comment


            • #7
              Originally posted by Jana Schue View Post
              Hello everyone, I came across this post because I have a similar problem. I use -xtreg- with fixed effects and time fixed effects and have autocorrelation and heteroskedasticity. I actually wanted to use vce(robust), but with vce(cluster gvkey) the regression works exactly the same.
              My question is to know if this command with vce can only fix heteroskedasticity, or if it also helps against autocorrelation? My supervisor for the masters thesis doesn't know much about this unfortunately, but said that he thinks you have to change the regression to a different type to fix autocorrelation.
              It would help me a lot if you guys could help me! If anyone has another good paper I could cite, I would be very happy.
              Jana,

              1) You are jumping on a thread which is fairly irrelevant to your question.

              2) Your question relates to a very specific Stata issue, which has been discussed on multiple threads and multiple times. -xtreg y x, fe robust- and -xtreg y x, fe robust cluster(id) produce the same results, because Stata is too clever for our own good.
              Stock and Watson relatively recently and very surprisingly showed that the only robust estimator is not consistent in panel data fixed effects models. So since Stata 11 or so, when you try to compute this robust estimator, Stata takes control over from you and "does the right thing" by computing the Arellano cluster/robust estimator, which is robust to both heteroskedasticity and arbitrary within id correlation.

              Comment


              • #8
                Joro,

                thank you very much for the answer. Please excuse the inconvenience, I'm still relatively new to Stata unfortunately.

                So that would mean that autocorrelation can also be fixed with the command and I don't have to jump from -xtreg- to another regression type just because of this autocorrelation? That would be great, of course.

                Comment


                • #9
                  Originally posted by Jana Schue View Post
                  Joro,

                  thank you very much for the answer. Please excuse the inconvenience, I'm still relatively new to Stata unfortunately.

                  So that would mean that autocorrelation can also be fixed with the command and I don't have to jump from -xtreg- to another regression type just because of this autocorrelation? That would be great, of course.
                  Yes, this is correct. If your cross sectional dimension is large (big N, lots of IDs), you can just use the Arellano variance estimator (robust, and robust cluster(id)), and you take care both of heteroskedasticity and arbitrary correlation within ID.

                  The current thinking in econometrics is that if you have a large cross section, controlling for heteroskedasticity and arbitrary within ID correlation comes for free.

                  Comment


                  • #10
                    Thank you very much!
                    Do you happen to have any idea about whether this applies to -xtpoisson- in the same way? I also use fixed and time-fixed effects at -xtpoisson-, but I also found autocorrelation and overdispersion.

                    Comment


                    • #11
                      Originally posted by Jana Schue View Post
                      Thank you very much!
                      Do you happen to have any idea about whether this applies to -xtpoisson- in the same way? I also use fixed and time-fixed effects at -xtpoisson-, but I also found autocorrelation and overdispersion.
                      I do not know what you mean by "this" in "whether this applies to -xtpoisson- in the same way".

                      Expert such as Prof. Wooldridge recommend always using robust standard errors with poisson regression. See this thread here
                      https://www.statalist.org/forums/for...tandard-errors

                      -xtpoisson, fe- does not offer the option of cluster robust standard errors. It does offer the option of robust only standard errors. If I were you I would use robust standard errors with -xtpoisson- and proceed with fingers crossed.

                      Comment


                      • #12
                        I find this revamped thread really interesting.
                        While it's true that -xtpoisson- does not offer the -vce(cluster clusterid)- option for standard errors:
                        Code:
                        . use https://www.stata-press.com/data/r17/ships
                        
                        . xtpoisson accident op_75_79 co_65_69 co_70_74 co_75_79, fe exp(service) irr vce(cluster ship)
                        option cluster not allowed
                        r(198);
                        ...when the -robust- option is invoked, the resulting standard errors seem to be clustered on the -panelvar-, though:
                        Code:
                        . xtpoisson accident op_75_79 co_65_69 co_70_74 co_75_79, fe exp(service) irr vce(robust)
                        
                        Iteration 0:   log pseudolikelihood = -80.738973  
                        Iteration 1:   log pseudolikelihood = -54.857546  
                        Iteration 2:   log pseudolikelihood = -54.641897  
                        Iteration 3:   log pseudolikelihood = -54.641859  
                        Iteration 4:   log pseudolikelihood = -54.641859  
                        
                        Conditional fixed-effects Poisson regression        Number of obs    =      34
                        Group variable: ship                                Number of groups =       5
                        
                                                                            Obs per group:
                                                                                         min =       6
                                                                                         avg =     6.8
                                                                                         max =       7
                        
                                                                            Wald chi2(4)     = 2582.51
                        Log pseudolikelihood = -54.641859                   Prob > chi2      =  0.0000
                        
                                                           (Std. err. adjusted for clustering on ship)
                        ------------------------------------------------------------------------------
                                     |               Robust
                            accident |        IRR   std. err.      z    P>|z|     [95% conf. interval]
                        -------------+----------------------------------------------------------------
                            op_75_79 |   1.468831   .1114026     5.07   0.000      1.26594     1.70424
                            co_65_69 |   2.008002   .1253984    11.16   0.000     1.776672    2.269453
                            co_70_74 |    2.26693   .2340937     7.93   0.000     1.851566    2.775474
                            co_75_79 |   1.573695   .2495366     2.86   0.004     1.153315    2.147303
                         ln(service) |          1  (exposure)
                        ------------------------------------------------------------------------------
                        
                        .
                        Kind regards,
                        Carlo
                        (Stata 19.0)

                        Comment


                        • #13
                          Carlo makes an excellent point explicitly -- that -xtpoisson, fe robust- quite explicitly tells us that it computes cluster-robust variance in the message "(Std. err. adjusted for clustering on ship)". So I learnt something new today, that -xtpoisson, fe- in terms of robustifying the variance behaves exactly as -xtreg, fe-.

                          Carlo makes another point implicitly -- it is very useful to read carefully the output of the command, which sometimes contains useful information as to what the command has done.

                          Comment


                          • #14
                            So to summarize, for -xtpoisson, fe- I can use the -vce(robust)- command to fix autocorrelation, just as I did for -xtreg-?
                            Thanks a lot to you guys, I really appreciate it and you helped me a lot!

                            Comment


                            • #15
                              Jana:
                              yes.
                              Kind regards,
                              Carlo
                              (Stata 19.0)

                              Comment

                              Working...
                              X