Announcement

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

  • How to Correct for Heteroscedasticity and Autocorrelation with single command in a Fixed Effects Panel Data Model?

    Hello respected member,
    i have Balance panel data consist 300 observations. my model include five independent, three control and one dependent variable. after running hausman test i found fix effect reg is appropriate. further i use heteroscedasticity and autocorrelation test and found that these two problem exist in the data. my question is there any single command through which i can remove both these two problem.

  • #2
    Amin:
    welcome to the list.
    Your query creeps up quite frequently on this forum.
    If you're dealing with a large N, small T panel dataset (please note that you should provide the list with all the useful details concerning your query; please see the FAQ about this and other topics. Thanks) and you suspect autocorrelation and/or heteroskedasticity, you should simply robustifying/clustering your standard errors:
    Code:
    xtreg <depvar> <indepvars>, fe vce(cluster panelid)
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Hi Carlo Lazzaro

      I have a panel dataset with large N (N=230) and small T (T=15).

      My methods are nonlinear, like so:
      Code:
       xtprobit <depvar> <indepvars>, re
      I have found that xttest commands are incompatible with xtprobit, so I am unable to conduct tests such as the Breusch-Pagan test for heteroskedastcity in the panel data residuals.

      Could I proceed and use clustered standard errors (just in case there is autocorrelation and/or heteroskedasticity, although I haven't been able to test for these)?

      Your advice would be much appreciated

      Thank you

      Comment


      • #4
        Rose:
        the following thread may be interesting http://www.stata.com/statalist/archi.../msg00278.html
        As an aside, please note that -xtest0- tests random effects, not heteroskedasticity (I assume you mistake it with -estat hettest-, which is included among -regress postestimation- commands).
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Many thanks for your reply Carlo Lazzaro

          There were some good suggestions in the link, although I think most of them (such as oglm and clogit) apply to Logit models. The link helped to confirm that robust standard errors correct for both heteroscedasticity and autocorrelation.

          Apologies, I meant to refer to xttest2 (the Breusch-Pagan test for heteroskedastcity), which does not seem to work for panel data.

          Unfortunately, estat hettest returned the following error message:
          Code:
          . estat hettest
          estat hettest not valid  
          r(321);
          So I suspect this is also incompatible with xtprobit.

          I am unsure of how to test for heteroskedasticity with xtprobit.
          As "heteroscedasticity has more severe consequences" for non-linear models (reference: https://en.wikipedia.org/wiki/Heteroscedasticity), I wonder whether it is better to include robust standard errors anyway, just in case?

          Thank you
          Last edited by Rose Simmons; 06 Mar 2017, 10:11.

          Comment


          • #6
            Rose:
            -estat hetest- works only after -regress-.
            I would compare both default and robust SEs, judge on their difference and then choose.
            However, using -vce(robust)- from scratch looks acceptable anyway.
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment


            • #7
              Thank you very much for your suggestion Carlo, I have now conducted a comparison.
              Both default SEs (column 1 below) and robust (column 2 below) SEs are similar (some more than others, such as age):

              Code:
              Variable     |    VCEoim    VCErob       
              -------------+------------------------------
                   
                    gender |   0.642     0.642      
                           |   0.209     0.250     
                       age |   0.001     0.001    
                           |   0.036     0.037
              I will proceed with -vce(robust)-
              Thank you for helping me with this

              Comment


              • #8
                Carlo Lazzaro thank you so much for sharing your knowledge .. really appreciated

                Comment


                • #9
                  @Carlo Lazzaro sir, could you please guide me what is (cluster panelid). i tried to run the command as you mentioned above but i found these results

                  xtreg ce npl car ppl lr clar bs ms roa, fe vce(cluster panelid)
                  variable panelid not found
                  r(111);


                  note ce is dependent variable, npl car ppl lr clar are independent, bs ms and roa are control

                  Comment


                  • #10
                    Amin:
                    -panelid- is the panel identifier of your panel dataset.
                    As you did not provide any clue about that (as you should have done, as per FAQ), I guessed that it was named -panelid-.
                    Put differently, it should be the first variable that you plugged in -xtset-.
                    Kind regards,
                    Carlo
                    (Stata 18.0 SE)

                    Comment


                    • #11
                      thank you Sir Carlo Lazzaro. i got your point.

                      Comment


                      • #12
                        Amin:
                        Carlo is enough!
                        Kind regards,
                        Carlo
                        (Stata 18.0 SE)

                        Comment


                        • #13
                          Originally posted by Carlo Lazzaro View Post
                          Rose:
                          -estat hetest- works only after -regress-.
                          I would compare both default and robust SEs, judge on their difference and then choose.
                          However, using -vce(robust)- from scratch looks acceptable anyway.
                          Carlo, is there a hetest for panel data? Or can I just do a regress and then hettest for my panel? It clearly rejects homosked.

                          For model choice between RE and POLS we use the xttest0? Can you elaborate a bit more on the difference between testing homoskedasticity and random effects? I am a bit confused by that.

                          Thank you in advance!

                          Comment


                          • #14
                            Katie:
                            q1) as far as I know, there's no such a test. I would compare both default and robust SEs, judge on their difference and then choose.

                            q2) Jeff' s reply at https://www.statalist.org/forums/for...chibar2-1-0000 showed that my idea about -xttest0- was wrong.
                            Kind regards,
                            Carlo
                            (Stata 18.0 SE)

                            Comment


                            • #15
                              I used -xtreg y x1 x2, fe robust- regression code for my panel data whose N is 12 and T is 156 (T>N).

                              I did some tests and had results shown below:

                              -xtcsd, pesaran abs- (serially correlated)
                              -xttest2- (serially correlated) (as I know, better choice for T>N panel data)
                              -xttest3- (homoscedastic)

                              xtreg d_tuketici_aflow l.d_tuketici_aflow d.mev_tp_toplam d_real_gdp d_inf l.zk_c d_vix map_akim, fe robust
                              . xttest2

                              Correlation matrix of residuals:

                              __e10 __e12 __e15 __e32 __e46 __e62 __e64 __e67 __e99 __e111 __e123 __e134
                              __e10 1.0000
                              __e12 0.4936 1.0000
                              __e15 0.4714 0.3560 1.0000
                              __e32 0.3381 0.3759 0.4100 1.0000
                              __e46 0.3999 0.5731 0.2429 0.3609 1.0000
                              __e62 0.4509 0.4699 0.4326 0.4840 0.4548 1.0000
                              __e64 0.5542 0.6000 0.5253 0.4104 0.5826 0.6475 1.0000
                              __e67 0.5378 0.6343 0.3881 0.5938 0.5494 0.6398 0.6490 1.0000
                              __e99 0.4521 0.5185 0.3365 0.6366 0.4273 0.5940 0.5556 0.6063 1.0000
                              __e111 0.3237 0.4738 0.4344 0.5702 0.4116 0.5538 0.5078 0.5742 0.5195 1.0000
                              __e123 0.3938 0.4455 0.2742 0.4954 0.4274 0.4422 0.4343 0.5366 0.6093 0.4166 1.0000
                              __e134 0.3317 0.2583 0.4056 0.5079 0.3044 0.4909 0.3377 0.3991 0.5360 0.3887 0.2866 1.0000

                              Breusch-Pagan LM test of independence: chi2(66) = 1996.413, Pr = 0.0000
                              Based on 131 complete observations over panel units
                              I kindly request a way to solve (as codes) this cross-sectional dependence problem as I could not find the solution anywhere on the net.

                              Comment

                              Working...
                              X