Announcement

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

  • hausman test for -xtivreg-

    With xtivreg, we could combine fixed-effect and random-effect model with instrumental variable model.
    For example, the fixed-effect and random effect models are as follows,
    xtivreg y (x=z1 z2 z3) controls, fe
    xtivreg y (x=z'1 z'2 z'3) controls, re

    As we can see, Fixed-effect model and random effect model use different set of instrumental variables. In this case, are the hausman test results still acountable? If not accountable, what test should we do to compare fixed effect and random effect models?
    The second question is what should we do if we can't find IVs for fixed effect model? In this case, should we just go for random effect?


    Thank you in advance for help! I'd really appreciate it if you could provide references also.


  • #2
    Johnny:
    I'd consider the community-contributed module -xtoverid- (its null is: -re- is the way to go).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Johnny:
      I'd consider the community-contributed module -xtoverid- (its null is: -re- is the way to go).
      Hi Carlo, thanks for replying.
      I searched in the forum, the xtoverid after xtivreg, fe should be testing the overidentification of the set of IVs, is that right?
      Because in my case, what I want to do is to do comparison between xtivreg, fe with xtivreg, re, in order to get a better estimation.

      Comment


      • #4
        Johnny:
        you could simply code -xtivreg, re- and then invoke -xtoverid-, like in the following tiy-example:
        Code:
        . use "https://www.stata-press.com/data/r17/nlswork.dta"
        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
        
        . xtset idcode year
        
        Panel variable: idcode (unbalanced)
         Time variable: year, 68 to 88, but with gaps
                 Delta: 1 unit
        
        . xtivreg ln_wage age (tenure = union south), re i(idcode)
        
        G2SLS random-effects IV regression              Number of obs     =     19,007
        Group variable: idcode                          Number of groups  =      4,134
        
        R-squared:                                      Obs per group:
             Within  = 0.0559                                         min =          1
             Between = 0.1401                                         avg =        4.6
             Overall = 0.0972                                         max =         12
        
                                                        Wald chi2(2)      =     542.92
        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
        
        ------------------------------------------------------------------------------
             ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              tenure |   .1962067   .0128332    15.29   0.000     .1710541    .2213594
                 age |  -.0398788   .0036139   -11.03   0.000    -.0469618   -.0327957
               _cons |   2.287752   .0698797    32.74   0.000      2.15079    2.424713
        -------------+----------------------------------------------------------------
             sigma_u |  .37862603
             sigma_e |  .64315554
                 rho |  .25737152   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        Instrumented: tenure
         Instruments: age union south
        
        . xtoverid
        
        Test of overidentifying restrictions:
        Cross-section time-series model: xtivreg g2sls  
        Sargan-Hansen statistic  97.874  Chi-sq(1)    P-value = 0.0000
        
        .
        See https://www.stata.com/statalist/arch.../msg00721.html
        Last edited by Carlo Lazzaro; 12 Jan 2023, 00:36.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Johnny:
          you could simply code -xtivreg, re- and then invoke -xtoverid-, like in the following tiy-example:
          Code:
          . use "https://www.stata-press.com/data/r17/nlswork.dta"
          (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
          
          . xtset idcode year
          
          Panel variable: idcode (unbalanced)
          Time variable: year, 68 to 88, but with gaps
          Delta: 1 unit
          
          . xtivreg ln_wage age (tenure = union south), re i(idcode)
          
          G2SLS random-effects IV regression Number of obs = 19,007
          Group variable: idcode Number of groups = 4,134
          
          R-squared: Obs per group:
          Within = 0.0559 min = 1
          Between = 0.1401 avg = 4.6
          Overall = 0.0972 max = 12
          
          Wald chi2(2) = 542.92
          corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
          
          ------------------------------------------------------------------------------
          ln_wage | Coefficient Std. err. z P>|z| [95% conf. interval]
          -------------+----------------------------------------------------------------
          tenure | .1962067 .0128332 15.29 0.000 .1710541 .2213594
          age | -.0398788 .0036139 -11.03 0.000 -.0469618 -.0327957
          _cons | 2.287752 .0698797 32.74 0.000 2.15079 2.424713
          -------------+----------------------------------------------------------------
          sigma_u | .37862603
          sigma_e | .64315554
          rho | .25737152 (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Instrumented: tenure
          Instruments: age union south
          
          . xtoverid
          
          Test of overidentifying restrictions:
          Cross-section time-series model: xtivreg g2sls
          Sargan-Hansen statistic 97.874 Chi-sq(1) P-value = 0.0000
          
          .
          See https://www.stata.com/statalist/arch.../msg00721.html
          Thanks!
          This might be a silly quesiton...
          But do we need to also test for the overidentification of IVs in the random effect also, if the overidentification of IVs in the fixed-effect model is good?

          Comment


          • #6
            Johnny:
            you can focus on the -fe- estimator as a second step of your analysis:
            Code:
            . use "https://www.stata-press.com/data/r17/nlswork.dta"
            (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
            
            . xtset idcode year
            
            Panel variable: idcode (unbalanced)
             Time variable: year, 68 to 88, but with gaps
                     Delta: 1 unit
            
            . xtivreg ln_wage age (tenure = union south), fe i(idcode)
            
            Fixed-effects (within) IV regression            Number of obs     =     19,007
            Group variable: idcode                          Number of groups  =      4,134
            
            R-squared:                                      Obs per group:
                 Within  =      .                                         min =          1
                 Between = 0.1261                                         avg =        4.6
                 Overall = 0.0869                                         max =         12
            
                                                            Wald chi2(2)      =  142054.65
            corr(u_i, Xb) = -0.6875                         Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                 ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                  tenure |   .2450528   .0382041     6.41   0.000     .1701741    .3199314
                     age |  -.0650873   .0126167    -5.16   0.000    -.0898156    -.040359
                   _cons |   2.826672   .2451883    11.53   0.000     2.346112    3.307232
            -------------+----------------------------------------------------------------
                 sigma_u |  .71990151
                 sigma_e |  .64315554
                     rho |  .55612637   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
             F test that all u_i=0: F(4133,14871) =     1.53          Prob > F    = 0.0000
            ------------------------------------------------------------------------------
            Instrumented: tenure
             Instruments: age union south
            
            . xtoverid
            
            Test of overidentifying restrictions: 
            Cross-section time-series model: xtivreg fe   
            Sargan-Hansen statistic   0.965  Chi-sq(1)    P-value = 0.3259
            
            .
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Johnny:
              you can focus on the -fe- estimator as a second step of your analysis:
              Code:
              . use "https://www.stata-press.com/data/r17/nlswork.dta"
              (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
              
              . xtset idcode year
              
              Panel variable: idcode (unbalanced)
              Time variable: year, 68 to 88, but with gaps
              Delta: 1 unit
              
              . xtivreg ln_wage age (tenure = union south), fe i(idcode)
              
              Fixed-effects (within) IV regression Number of obs = 19,007
              Group variable: idcode Number of groups = 4,134
              
              R-squared: Obs per group:
              Within = . min = 1
              Between = 0.1261 avg = 4.6
              Overall = 0.0869 max = 12
              
              Wald chi2(2) = 142054.65
              corr(u_i, Xb) = -0.6875 Prob > chi2 = 0.0000
              
              ------------------------------------------------------------------------------
              ln_wage | Coefficient Std. err. z P>|z| [95% conf. interval]
              -------------+----------------------------------------------------------------
              tenure | .2450528 .0382041 6.41 0.000 .1701741 .3199314
              age | -.0650873 .0126167 -5.16 0.000 -.0898156 -.040359
              _cons | 2.826672 .2451883 11.53 0.000 2.346112 3.307232
              -------------+----------------------------------------------------------------
              sigma_u | .71990151
              sigma_e | .64315554
              rho | .55612637 (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              F test that all u_i=0: F(4133,14871) = 1.53 Prob > F = 0.0000
              ------------------------------------------------------------------------------
              Instrumented: tenure
              Instruments: age union south
              
              . xtoverid
              
              Test of overidentifying restrictions:
              Cross-section time-series model: xtivreg fe
              Sargan-Hansen statistic 0.965 Chi-sq(1) P-value = 0.3259
              
              .
              Thank you!

              Comment

              Working...
              X