Announcement

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

  • how to fix heteroskedasticity, autocorrelation in stata 14.2

    I am working for my thesis with panel data where N> T (N~700, T=4 as the attached file ). I carried out random - effect, OLS, fixed- effect and then did hausman test to know which model is better for my data. As the result i chose fixed defect ( P value <0.005)
    After this, I applied some tests to verify problems of heteroskedasticity, autocorrelation such as:
    collin
    xttest3 (heteroskedasticity)
    xtserial (autocorrelation)
    The result is that my models present problems of heteroskedasticity, autocorrelation but I don't know exactly the way to fix these problems in stata 14
    I intended to use the option xtreg .... fe, cluster (country)
    + is this ok to fix my data?
    Actually, I have seen some of article in which the instruction is that first run fe cluster and re cluster then run xtoverid to choose the better . But when I ran xtoverid command, the screen became like this " xtoverid Error - must have ivreg2/ivreg29/ivreg28 version 2.1.15 or greater installedr(601)" so I think that xtoverid did not work in stata 14

    I will be very grateful for your opinion regarding what I am doing, it will be a great help.

  • #2
    Here is the attached file for my data
    Attached Files

    Comment


    • #3
      Nguyen:
      clustered standard errors take into account both heteroskedasticity and autocorrelation: hence, your choice is correct.
      After installing -xtoverid- on my old Stata 14.2 SE release, everything works as expected:
      Code:
      . use "http://www.stata-press.com/data/r14/nlswork", clear
      (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
      
      . xtreg ln_wage race, vce(cluster idcode)
      
      Random-effects GLS regression                   Number of obs     =     28,534
      Group variable: idcode                          Number of groups  =      4,711
      
      R-sq:                                           Obs per group:
           within  = 0.0000                                         min =          1
           between = 0.0121                                         avg =        6.1
           overall = 0.0133                                         max =         15
      
                                                      Wald chi2(1)      =      58.28
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
                                   (Std. Err. adjusted for 4,711 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              race |  -.0994584   .0130283    -7.63   0.000    -.1249934   -.0739234
             _cons |   1.786115   .0177469   100.64   0.000     1.751332    1.820898
      -------------+----------------------------------------------------------------
           sigma_u |  .38371707
           sigma_e |  .32028665
               rho |  .58937401   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . xtoverid
      
      Test of overidentifying restrictions: fixed vs random effects
      Cross-section time-series model: xtreg re  robust cluster(idcode)
      Sargan-Hansen statistic  58.278  Chi-sq(1)    P-value = 0.0000
      
      .
      My guess is that you should install one of the suggested community-contributed -ivreg*- commands and then give it another try.
      As an aside, please do not attach spreadsheets (that nobody would ever download due to the risk of active contents) and use CODE delimiters instead to share what you typed and what Stata gave you back (as per FAQ). Thanks.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Dear Mr Carlo Lazzaro
        First, thank you so much for your instruction
        I did as your instruction , and it has worked . But I wonder whether it is necessary for me to run vce cluster then xtoverid like ( below )to choose between fem and rem or I just need run fe cluster to fix the problem of both heteroskedasticity and autocorrelation in fe test
        [CODE]
        Click image for larger version

Name:	1.PNG
Views:	1
Size:	22.4 KB
ID:	1568530

        Thanks
        Kind regards
        Linh

        Comment

        Working...
        X