Announcement

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

  • hettest and xttest3 not valid

    Hi all,

    I am looking to carry out some residual diagnostics on my model

    xtreg LGDP l.LGDP K H, fe


    I want to carry out some tests for autocorrelation and heteroscedasticity. I am using Stata 15.0 but i cannot seem to utilise any of the following tests with code i find on other forums such as:

    ssc install xtserial - cannot find the serial autocorrelation test

    ssc install xtest3 - cannot find a test for heteroscedasticity

    hettest - invalid

    Is there a new way to download the user-written programmes for these tests or are there in-built functions now?


    Thanks in advance,
    Matt

  • #2
    as far as I can see -xtserial- and -xttest3- are from the Stata Journal, not SSC; use -findit- or -search- for locating and downloading; -hettest- (now -estat hettest-) is for use after -regress- and, as far as I know, cannot be used after -xtreg-

    Comment


    • #3
      lovely, thank you

      Comment


      • #4
        Dear All... i want to run heteroscedasticity (xttest3), i have installed via ssc install and it says "installation complete". however later, when i type "xttest3" it says "last estimates not found" (red color).. can anyone help me..? i have 6 N and 19 Years. i am using stata 14.2
        Last edited by raditya sukmana; 16 Jan 2023, 02:07.

        Comment


        • #5
          Raditya:
          welcome to this forum.
          Please refer to -xttest3- command as a community-contributed module, for reasons that are well expleined in the FAQ. Thanks.
          That said, please note that -xttest3- was developed to work after -xtreg, fe- or -xtgls- (quoting from its help file):
          Code:
          . use "https://www.stata-press.com/data/r17/nlswork.dta"
          (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
          
          . xtreg ln_wage c.age##c.age, re vce(cluster idcode)
          
          Random-effects GLS 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.1015                                         avg =        6.1
               Overall = 0.0870                                         max =         15
          
                                                          Wald chi2(2)      =    1258.33
          corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
          
                                       (Std. err. adjusted for 4,710 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   age |   .0590339   .0041049    14.38   0.000     .0509884    .0670795
                       |
           c.age#c.age |  -.0006758   .0000688    -9.83   0.000    -.0008107    -.000541
                       |
                 _cons |   .5479714   .0587198     9.33   0.000     .4328826    .6630601
          -------------+----------------------------------------------------------------
               sigma_u |   .3654049
               sigma_e |  .30245467
                   rho |  .59342665   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          
          . xttest3
          last estimates not xtreg, fe
          r(301);
          
          . reg ln_wage c.age##c.age, vce(cluster idcode)
          
          Linear regression                               Number of obs     =     28,510
                                                          F(2, 4709)        =     701.39
                                                          Prob > F          =     0.0000
                                                          R-squared         =     0.0882
                                                          Root MSE          =     .45654
          
                                       (Std. err. adjusted for 4,710 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   age |   .0855891   .0046943    18.23   0.000     .0763861    .0947922
                       |
           c.age#c.age |  -.0010982   .0000798   -13.76   0.000    -.0012547   -.0009417
                       |
                 _cons |   .1647917   .0655679     2.51   0.012      .036248    .2933354
          ------------------------------------------------------------------------------
          
          . xttest3
          last estimates not found
          r(301);
          
          . 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
          
          
          ..
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thanks DR Carlo,,it works,,,many many thanks,,,it really helpful,,,

            Comment

            Working...
            X