Announcement

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

  • How to test for hetrosked in fixed effects and how to perform the robust hausman test:

    Hi everyone Im struggling a bit would apprechiate some help:

    my inital fixed effects model is this:

    ​​​​​​xtreg lntobinsq lnassets Deriv IR bookleverage roa_w1 cratio_w1 rnd_rev_w1 cash_to_totalassets div_yield_w1 yeardummy if inlist(year,2015,2016)

    1) How do I test for hetroskedascity for this fe model, I read around and found it to be xttest3? is groupwise hetroskedascity the same as normal hetro?

    2) I am trying to perform a robust hausman on this model via the xtoverid
    a) I know you can't include the time dummies in the simple hausman but can you include the time dummies in this robust hausman test:

    b) also want to know how to accurately implement this test: if I used the exact command above and tried, would it be like this:

    Code:
    . xtreg lntobinsq lnassets Deriv IR  bookleverage roa_w1 cratio_w1 rnd_rev_w1 cash_to_totalassets div_yield_w1 year2016 if inlist(year,2015,2016), fe robust
    
    Fixed-effects (within) regression               Number of obs     =        586
    Group variable: firmid                          Number of groups  =        306
    
    R-sq:                                           Obs per group:
         within  = 0.3854                                         min =          1
         between = 0.1586                                         avg =        1.9
         overall = 0.1726                                         max =          2
    
                                                    F(10,305)         =      15.70
    corr(u_i, Xb)  = -0.7459                        Prob > F          =     0.0000
    
                                          (Std. Err. adjusted for 306 clusters in firmid)
    -------------------------------------------------------------------------------------
                        |               Robust
              lntobinsq |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------------+----------------------------------------------------------------
               lnassets |  -.4470604   .0687788    -6.50   0.000    -.5824015   -.3117193
        Deriv .            |   .0766741   .0925322     0.83   0.408    -.1054082    .2587564
        IR .                      |  -.0954453   .0659056    -1.45   0.149    -.2251325    .0342419
           bookleverage |   .1864517    .120672     1.63   0.105    -.0410034    .4339067
                 roa_w1 |    .014447   .0077733     1.86   0.064    -.0008491     .029743
              cratio_w1 |  -.0616183   .0234384    -2.63   0.009    -.1077398   -.0154968
             rnd_rev_w1 |  -.0150043    .014466    -1.04   0.300    -.0434701    .0134615
    cash_to_totalassets |   .1879683   .2583643     0.69   0.491    -.3304338    .6863704
           div_yield_w1 |   -.053192   .0087376    -4.94   0.000    -.0603856   -.0259985
               year2016 |   .0303004   .0138687     1.46   0.144    -.0069901    .0475909
                  _cons |   3.728503   .4793996     7.99   0.000     2.885154    4.771853
    --------------------+----------------------------------------------------------------
                sigma_u |  .76302993
                sigma_e |  .11779167
                    rho |   .9767235   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------------
    
    . 
    . est store fixed
    
    . 
    . xtreg lntobinsq lnassets FXDerivatives10 IRDerivatives10  bookleverage roa_w1 cratio_w1 rnd_rev_w1 cash_to_totalass
    > ets div_yield_w1 year2016 if inlist(year,2015,2016), re robust
    
    Random-effects GLS regression                   Number of obs     =        586
    Group variable: firmid                          Number of groups  =        306
    
    R-sq:                                           Obs per group:
         within  = 0.2040                                         min =          1
         between = 0.6631                                         avg =        1.9
         overall = 0.6317                                         max =          2
    
                                                    Wald chi2(10)     =     203.50
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
    
                                          (Std. Err. adjusted for 306 clusters in firmid)
    -------------------------------------------------------------------------------------
                        |               Robust
              lntobinsq |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    --------------------+----------------------------------------------------------------
               lnassets |  -.0670922   .0143928    -3.97   0.000    -.0853017   -.0288828
                    Deriv |   .0849556   .0341868     2.78   0.005     .0279506    .1619606
                        IR   |  -.1269466    .038487    -3.30   0.001    -.2023798   -.0515133
           bookleverage |   .0960349   .0816089     1.14   0.254    -.0669155    .2529853
                 roa_w1 |     .05175   .0101699     5.09   0.000     .0318173    .0716826
              cratio_w1 |  -.0658327   .0151559    -4.94   0.000    -.1045376   -.0451277
             rnd_rev_w1 |   .0149893   .0040661     3.69   0.000     .0070198    .0229588
    cash_to_totalassets |   .4445181   .1900494     2.34   0.019     .0720282     .817008
           div_yield_w1 |  -.0456181   .0082363    -5.90   0.000    -.0647609   -.0324753
               year2016 |  -.0151233    .010654    -1.51   0.130    -.0370048    .0047583
                  _cons |   .8223877   .1466037     5.61   0.000     .5350496    1.109726
    --------------------+----------------------------------------------------------------
                sigma_u |  .28804944
                sigma_e |  .11779167
                    rho |  .85673459   (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(firmid)
    Sargan-Hansen statistic 100.089  Chi-sq(10)   P-value = 0.0000
    if this is wrong please let me know how to do it exactly. Thanks

    and if this is right does the very low p value indicate we use FE?


    3)Is the resulting test stat equal to a hausman stat or completely different?

    4) I am doing this for my project so do I only run the robust Hausman, or do I run both the normal and then the robust hausman xtoverid (or is this wrong) just asking as I would like to show the comparison of the coefficients between fe and re in the appendix or something and was wondering if this is even possible in this situation)

    Thanks everyone for being so helpful and insightful, any help is apprechiated. Thanks
    Last edited by Prathvajeeth Rajmohan; 01 Sep 2017, 13:10.

  • #2
    Prash:
    - in panel data regression the interest focuses on groupwise heteroskedasticity (as per -xttest3-);
    - -xtoverid- outcome points you out to -fe- specification;
    - there's no use in reporting both -hausman- test outcomes if you decided to go -robust- (or -cluster-). Hence., I would report -xtoverid- results only.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Prash:
      - in panel data regression the interest focuses on groupwise heteroskedasticity (as per -xttest3-);
      - -xtoverid- outcome points you out to -fe- specification;
      - there's no use in reporting both -hausman- test outcomes if you decided to go -robust- (or -cluster-). Hence., I would report -xtoverid- results only.
      Hi Carlo thanks, but did I do the xtoverid correctly as shown above? and can you include time dummies in the the xoverid (robust hausman test) Thanks

      Comment


      • #4
        Prash:
        you can inlcude -i.year- in -xtoverid- as long as you prefix your code with -xi-, as you can see from the following example:
        Code:
        . use http://www.stata-press.com/data/r14/nlswork.dta
        (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
        
        . xi: xtreg ln_wage i.year age, vce(cluster idcode) fe
        i.year            _Iyear_68-88        (naturally coded; _Iyear_68 omitted)
        
        Fixed-effects (within) regression               Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1060                                         min =          1
             between = 0.0914                                         avg =        6.1
             overall = 0.0805                                         max =         15
        
                                                        F(15,4709)        =      69.49
        corr(u_i, Xb)  = 0.0467                         Prob > F          =     0.0000
        
                                     (Std. Err. adjusted for 4,710 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
           _Iyear_69 |   .0748621   .0156425     4.79   0.000     .0441955    .1055287
           _Iyear_70 |   .0478697   .0265729     1.80   0.072    -.0042256    .0999649
           _Iyear_71 |   .0865577   .0385328     2.25   0.025     .0110155       .1621
           _Iyear_72 |   .0856757   .0505004     1.70   0.090    -.0133288    .1846802
           _Iyear_73 |   .0880069   .0626993     1.40   0.160    -.0349132    .2109269
           _Iyear_75 |   .0778607   .0865126     0.90   0.368    -.0917446     .247466
           _Iyear_77 |    .108365   .1111117     0.98   0.329    -.1094659    .3261959
           _Iyear_78 |   .1309518   .1237306     1.06   0.290    -.1116181    .3735217
           _Iyear_80 |   .1142649   .1480678     0.77   0.440    -.1760172    .4045471
           _Iyear_82 |   .1090451   .1724619     0.63   0.527    -.2290608    .4471511
           _Iyear_83 |   .1211272   .1846402     0.66   0.512    -.2408539    .4831083
           _Iyear_85 |   .1465637   .2092454     0.70   0.484    -.2636552    .5567825
           _Iyear_87 |   .1382642   .2341219     0.59   0.555    -.3207242    .5972527
           _Iyear_88 |   .1799741   .2500607     0.72   0.472    -.3102618      .67021
                 age |   .0125992   .0123091     1.02   0.306    -.0115323    .0367308
               _cons |   1.203731    .235213     5.12   0.000     .7426037    1.664859
        -------------+----------------------------------------------------------------
             sigma_u |   .4058746
             sigma_e |  .30300411
                 rho |  .64212421   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        . estimates store fe
        
        . xi: xtreg ln_wage i.year age, vce(cluster idcode) re
        i.year            _Iyear_68-88        (naturally coded; _Iyear_68 omitted)
        
        Random-effects GLS regression                   Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1060                                         min =          1
             between = 0.0918                                         avg =        6.1
             overall = 0.0807                                         max =         15
        
                                                        Wald chi2(15)     =    1244.11
        corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
        
                                     (Std. Err. adjusted for 4,710 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
           _Iyear_69 |   .0744312   .0102944     7.23   0.000     .0542545    .0946078
           _Iyear_70 |   .0453659   .0106757     4.25   0.000     .0244419    .0662899
           _Iyear_71 |   .0819949   .0116296     7.05   0.000     .0592013    .1047885
           _Iyear_72 |   .0827461   .0129338     6.40   0.000     .0573963    .1080959
           _Iyear_73 |   .0840751   .0138388     6.08   0.000     .0569516    .1111986
           _Iyear_75 |   .0707387   .0162295     4.36   0.000     .0389295    .1025479
           _Iyear_77 |   .1032639   .0193333     5.34   0.000     .0653713    .1411565
           _Iyear_78 |   .1279039   .0210903     6.06   0.000     .0865676    .1692401
           _Iyear_80 |    .108871   .0247186     4.40   0.000     .0604235    .1573185
           _Iyear_82 |    .098831    .027873     3.55   0.000      .044201    .1534611
           _Iyear_83 |   .1127655   .0301942     3.73   0.000      .053586     .171945
           _Iyear_85 |   .1380611   .0335078     4.12   0.000     .0723871    .2037351
           _Iyear_87 |   .1264818   .0373374     3.39   0.001     .0533019    .1996617
           _Iyear_88 |   .1640382   .0402879     4.07   0.000     .0850755    .2430009
                 age |   .0137208   .0019471     7.05   0.000     .0099046     .017537
               _cons |   1.162473   .0397287    29.26   0.000     1.084606     1.24034
        -------------+----------------------------------------------------------------
             sigma_u |  .36664367
             sigma_e |  .30300411
                 rho |  .59418375   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        . estimates store re
        
        . xtoverid
        
        Test of overidentifying restrictions: fixed vs random effects
        Cross-section time-series model: xtreg re  robust cluster(idcode)
        Sargan-Hansen statistic  79.267  Chi-sq(15)   P-value = 0.0000
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo thanks so much:



          also regarding the sarg-hansen test statistic/p value is the null hypothesis that Random effects is preffered?

          Comment


          • #6
            if I dont use I year but rather simpy the year dummy: year2016 would I have to run the above commands in a different way? thanks

            Comment


            • #7
              Prash:
              -xtoverid- outcome point you to -fe- (not -re-) specification;
              -i.year2016- will not change the -xi- prefix requirement.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Originally posted by Carlo Lazzaro View Post
                Prash:
                -xtoverid- outcome point you to -fe- (not -re-) specification;
                -i.year2016- will not change the -xi- prefix requirement.
                thank you Carlo, sorry still confused: regarding this

                ​​​​​​
                Code:
                Test of overidentifying restrictions: fixed vs random effects Cross-section time-series model: xtreg re robust cluster(idcode) Sargan-Hansen statistic 79.267 Chi-sq(15) P-value = 0.0000
                what exactly is the null hypothesis? thanks

                Comment


                • #9
                  Prash:
                  the null is that the overidentifying restrictions of -re- vs -fe- (no correlation between the vector of regressors and idiosyncratic error; no correlation between the vector of regressors and group-specific error).
                  If the null is not rejected, go -re-; if the null is rejected (like in your example), go -fe-.
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    Originally posted by Carlo Lazzaro View Post
                    Prash:
                    the null is that the overidentifying restrictions of -re- vs -fe- (no correlation between the vector of regressors and idiosyncratic error; no correlation between the vector of regressors and group-specific error).
                    If the null is not rejected, go -re-; if the null is rejected (like in your example), go -fe-.
                    Hi Carlo are there any sources/books I can cite and use to explain this test in my essay, or is a feature exclusive to stata only? thanks

                    Comment


                    • #11
                      Prash:
                      see -search xtoverid-.
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Code:
                        . xi: xtreg lntobinsq lnassets FXDerivatives10 IRDerivatives10  bookleverage_w1 roa_w1 cratio_w1 RND_ASSETS_PERCENT c
                        > ash_to_totalassets_w1 div_yield_w1 i.year if inlist(year,2015,2016), fe robust
                        i.year            _Iyear_2013-2016    (naturally coded; _Iyear_2013 omitted)
                        note: _Iyear_2014 omitted because of collinearity
                        note: _Iyear_2016 omitted because of collinearity
                        
                        Fixed-effects (within) regression               Number of obs     =        586
                        Group variable: firmid                          Number of groups  =        306
                        
                        R-sq:                                           Obs per group:
                             within  = 0.3784                                         min =          1
                             between = 0.1894                                         avg =        1.9
                             overall = 0.1995                                         max =          2
                        
                                                                        F(10,305)         =      17.49
                        corr(u_i, Xb)  = -0.7252                        Prob > F          =     0.0000
                        
                                                                 (Std. Err. adjusted for 306 clusters in firmid)
                        ----------------------------------------------------------------------------------------
                                               |               Robust
                                     lntobinsq |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                        -----------------------+----------------------------------------------------------------
                                      lnassets |  -.4220572   .0733919    -5.75   0.000    -.5664758   -.2776387
                               FXDerivatives10 |   .0753074   .0890297     0.85   0.398    -.0998827    .2504975
                               IRDerivatives10 |  -.0911909   .0658093    -1.39   0.167    -.2206886    .0383068
                               bookleverage_w1 |    .162326   .1375938     1.18   0.239    -.1084273    .4330792
                                        roa_w1 |   .0162543   .0086151     1.89   0.060    -.0006982    .0332068
                                     cratio_w1 |  -.0620082   .0195376    -3.17   0.002    -.1004537   -.0235626
                            RND_ASSETS_PERCENT |   .0051209   .0125551     0.41   0.684    -.0195847    .0298264
                        cash_to_totalassets_w1 |   .2257015   .2996455     0.75   0.452    -.3639326    .8153355
                                  div_yield_w1 |  -.0441328   .0088118    -5.01   0.000    -.0614726   -.0267931
                                   _Iyear_2014 |          0  (omitted)
                                   _Iyear_2015 |  -.0163724    .013857    -1.18   0.238    -.0436397     .010895
                                   _Iyear_2016 |          0  (omitted)
                                         _cons |   3.626495    .529412     6.85   0.000     2.584733    4.668257
                        -----------------------+----------------------------------------------------------------
                                       sigma_u |  .72261949
                                       sigma_e |  .11846442
                                           rho |  .97382789   (fraction of variance due to u_i)
                        ----------------------------------------------------------------------------------------
                        
                        . 
                        end of do-file
                        
                        . do "/var/folders/yj/dw8fyfcn7c53zs5v1mt4j3nw0000gn/T//SD00483.000000"
                        
                        . estimates store fe
                        
                        . 
                        end of do-file
                        
                        . do "/var/folders/yj/dw8fyfcn7c53zs5v1mt4j3nw0000gn/T//SD00483.000000"
                        
                        . xi: xtreg lntobinsq lnassets FXDerivatives10 IRDerivatives10  bookleverage_w1 roa_w1 cratio_w1 RND_ASSETS_PERCENT c
                        > ash_to_totalassets_w1 div_yield_w1 i.year if inlist(year,2015,2016), re robust
                        i.year            _Iyear_2013-2016    (naturally coded; _Iyear_2013 omitted)
                        note: _Iyear_2016 omitted because of collinearity
                        
                        Random-effects GLS regression                   Number of obs     =        586
                        Group variable: firmid                          Number of groups  =        306
                        
                        R-sq:                                           Obs per group:
                             within  = 0.2240                                         min =          1
                             between = 0.6495                                         avg =        1.9
                             overall = 0.6201                                         max =          2
                        
                                                                        Wald chi2(10)     =          .
                        corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =          .
                        
                                                                 (Std. Err. adjusted for 306 clusters in firmid)
                        ----------------------------------------------------------------------------------------
                                               |               Robust
                                     lntobinsq |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                        -----------------------+----------------------------------------------------------------
                                      lnassets |  -.0518932    .014566    -3.56   0.000    -.0804421   -.0233443
                               FXDerivatives10 |   .0904743   .0341417     2.65   0.008     .0235577    .1573909
                               IRDerivatives10 |  -.1322111   .0386664    -3.42   0.001    -.2079958   -.0564264
                               bookleverage_w1 |   .0961782   .0856465     1.12   0.261    -.0716858    .2640422
                                        roa_w1 |   .0497622   .0099342     5.01   0.000     .0302914    .0692329
                                     cratio_w1 |  -.0699314   .0125218    -5.58   0.000    -.0944738   -.0453891
                            RND_ASSETS_PERCENT |   .0190293   .0066694     2.85   0.004     .0059574    .0321012
                        cash_to_totalassets_w1 |   .5304127   .1840074     2.88   0.004     .1697649    .8910605
                                  div_yield_w1 |  -.0492183   .0081939    -6.01   0.000    -.0652781   -.0331585
                                   _Iyear_2014 |          0  (omitted)
                                   _Iyear_2015 |   .0162523   .0105328     1.54   0.123    -.0043916    .0368962
                                   _Iyear_2016 |          0  (omitted)
                                         _cons |   .7741229   .1477344     5.24   0.000     .4845688    1.063677
                        -----------------------+----------------------------------------------------------------
                                       sigma_u |  .29251283
                                       sigma_e |  .11846442
                                           rho |  .85909479   (fraction of variance due to u_i)
                        ----------------------------------------------------------------------------------------
                        
                        . 
                        end of do-file
                        
                        . do "/var/folders/yj/dw8fyfcn7c53zs5v1mt4j3nw0000gn/T//SD00483.000000"
                        
                        . estimates store re
                        
                        . 
                        end of do-file
                        
                        . do "/var/folders/yj/dw8fyfcn7c53zs5v1mt4j3nw0000gn/T//SD00483.000000"
                        
                        . xtoverid
                        o. operator not allowed
                        r(101);
                        
                        end of do-file
                        
                        r(101);
                        
                        .
                        Hi carlo whenver I try and do this it gives this error at the bottom?

                        Comment


                        • #13
                          Prash:
                          have you tried running all the codes from an unique -do- file?
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Originally posted by Carlo Lazzaro View Post
                            Prash:
                            have you tried running all the codes from an unique -do- file?
                            Hi Carlo, can you still use this xoverid test if you have an unbalanced panel?

                            Comment


                            • #15
                              Yes.
                              Kind regards,
                              Carlo
                              (Stata 19.0)

                              Comment

                              Working...
                              X