Announcement

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

  • Testing for heteroskedasticty using FE OLS and RE GLS

    Hi everyone,

    I am currently trying to test for heteroskedasticity using an unbalanced panel and FE OLS and RE GLS estimation. Using xttest0 I can perform the Breusch Pagan test for RE with no problem.

    However, the Breucsh Pagan xttest2 command for my FE estimation won't work. I was wondering whether this is because my panel is unbalanced?
    I get this error command: too few common observations across panel.

    How come the brush pagan test works for an unbalanced panel estimated through RE and not FE?

  • #2
    Emily:
    welcome to this forum.
    The short answer is that, despite sharing a similar label with -estat hettest-, -xttest0- does not check for heteroskedasticity after -xtreg,re- (see -xtest0- description under -xtreg prostestimation- entry, Stata .pdf manual).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Thank you for your quick response. What Stata command should I use then to test for heteroskedasticity after RE. Also is xttest3 my best bet for FE?

      Comment


      • #4
        Emily:
        as no analytical test for testing heteroskedasticity after -xtreg,re- was developed, visual inspection (see, for instance, -help qnorm-).
        That said, if you have a pretty large number of panels and you impose cluastered robust standard errors due to serial correlation, please note that under -xtreg- the non-default standard error will take also heteroskedasticity into account.
        The community-contributed (as you're kindly asked to mention, due to sound reasons explained in the FAQ) module -xttest3- is ok for testing heteroskedasticity after -xtreg,fe-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo,
          Thank you so much for your help. I was wondering what would be the best distributional plot to analyze heteroskedasticity? Also are there any benefits of performing the xttest0 B-P Lagrange multiplier test after xtreg, re?

          Comment


          • #6
            Emily:
            in the following toy-example you will find the code for -qnorm- for a clearly heteroskedastic epsilon distribution and the confirmation that a group-wise effect does exist (via -xttest0-: this is the benefit in running it, as far as I can get your question):
            Code:
            . use "https://www.stata-press.com/data/r16/nlswork.dta"
            (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
            
            . xtreg ln_wage c.age##c.age, re
            
            Random-effects GLS regression                   Number of obs     =     28,510
            Group variable: idcode                          Number of groups  =      4,710
            
            R-sq:                                           Obs per group:
                 within  = 0.1087                                         min =          1
                 between = 0.1015                                         avg =        6.1
                 overall = 0.0870                                         max =         15
            
                                                            Wald chi2(2)      =    3388.51
            corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                 ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     age |   .0590339   .0027172    21.73   0.000     .0537083    .0643596
                         |
             c.age#c.age |  -.0006758   .0000451   -15.00   0.000    -.0007641   -.0005876
                         |
                   _cons |   .5479714   .0397476    13.79   0.000     .4700675    .6258752
            -------------+----------------------------------------------------------------
                 sigma_u |   .3654049
                 sigma_e |  .30245467
                     rho |  .59342665   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            
            . predict epsilon, e
            (24 missing values generated)
            
            . qnorm epsilon
            
            . xttest0
            
            Breusch and Pagan Lagrangian multiplier test for random effects
            
                    ln_wage[idcode,t] = Xb + u[idcode] + e[idcode,t]
            
                    Estimated results:
                                     |       Var     sd = sqrt(Var)
                            ---------+-----------------------------
                             ln_wage |   .2285836       .4781042
                                   e |   .0914788       .3024547
                                   u |   .1335207       .3654049
            
                    Test:   Var(u) = 0
                                         chibar2(01) = 28074.51
                                      Prob > chibar2 =   0.0000
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              I have N=150 T=9 in my dataset (unbalanced). I was wondering whether using xttest3 after xtgls is a viable option or whether that will not work with my panel dimensions.

              Comment


              • #8
                Emily:
                -xtgls- is usually ok when T>N (which is not your case).
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Thanks for your guidance, I have now visually inspected by residuals for RE. Visual inspection seems to point at no heteroskedasticity under RE estimation, however, my wald test for heteroskedasticity under FE indicates heteroskedasticity is present.

                  is it possible for heteroskedasticity to exist under FE and not RE?

                  Comment


                  • #10
                    Emily:
                    systematic error are not expected to be (exactly) the same under -fe- and -re- specifications.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment

                    Working...
                    X