Announcement

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

  • Test for Heterogeneity in Fixed Effects

    Hi,

    I am trying to run a fixed effects model on my panel dataset, I have completed a Hausman test which points me towards a fixed effects model, however I am unsure how to run a test for heterogeneity.

    Any suggestions would be greatly appreciated!

  • #2
    Ravi:
    welcome to this forum.
    If you mean heteroskedasticity, you may want to type -search xttest3-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you, great to be here.
      Sorry yes I do mean heteroskedasticity, this redirects me to a help page.

      Is there a test for heteroskedasticity that I can apply to the panel data for a fixed effects model?

      Comment


      • #4
        Ravi:
        the following toy-example can be helpful:
        Code:
        . use "https://www.stata-press.com/data/r18/nlswork.dta"
        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
        
        . xtreg ln_wage c.age##c.age, fe vce(cluster idcode)
        
        Fixed-effects (within) regression               Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-squared:                                      Obs per group:
             Within  = 0.1087                                         min =          1
             Between = 0.1006                                         avg =        6.1
             Overall = 0.0865                                         max =         15
        
                                                        F(2, 4709)        =     507.42
        corr(u_i, Xb) = 0.0440                          Prob > F          =     0.0000
        
                                     (Std. err. adjusted for 4,710 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 age |   .0539076    .004307    12.52   0.000     .0454638    .0623515
                     |
         c.age#c.age |  -.0005973    .000072    -8.30   0.000    -.0007384   -.0004562
                     |
               _cons |    .639913   .0624195    10.25   0.000     .5175415    .7622845
        -------------+----------------------------------------------------------------
             sigma_u |   .4039153
             sigma_e |  .30245467
                 rho |  .64073314   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        . xttest3
        
        Modified Wald test for groupwise heteroskedasticity
        in fixed effect regression model
        
        H0: sigma(i)^2 = sigma^2 for all i
        
        chi2 (4710)  =  4.4e+35
        Prob>chi2 =      0.0000
        
        
        .
        The outcome of the community-contributed module -xttest3- shows evidence of heteroskedasticity.
        Next step: do nothing, as the cluster robust standard error was already added (and repeating the test is unhelpful, as it assesses the residual distribution - that remains the same- and not the correction due to heteroskedasticity that the cluster-robust standard error applies to take heteroskedasticity into account).
        Eventually, please note that, unlike -regress-, the options -robust- and -vce(cluster clusterid)- do the very same job under -xtreg- (that is, they take heteroskedasticity and/or autocorrelation into account).
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Hi Carlo, thank you for the guidance that does make a lot more sense to me. However, unfortunately STATA is not recognising the -xttest3- command once I regress my model.

          Click image for larger version

Name:	Screenshot 2024-03-04 at 11.59.05.png
Views:	1
Size:	843.5 KB
ID:	1745446

          Comment


          • #6
            Ravi:
            being a community-contributed module, follow the instructions to install it typing -search xttest3- from within Stata.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Thank you Carlo, I have been able to now observe the results for xttest3

              Kind Regards,
              Ravi

              Comment

              Working...
              X