Announcement

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

  • #16
    Eduard:
    in the following trivial toy-example, -xtoverid- and -rhausman- outcomes concur in rejecting the null:
    Code:
    . use https://www.stata-press.com/data/r19/nlswork.dta
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . xtreg ln_wage age, vce(cluster idcode) re
    
    Random-effects GLS regression                   Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1026                                         min =          1
         Between = 0.0877                                         avg =        6.1
         Overall = 0.0774                                         max =         15
    
                                                    Wald chi2(1)      =    1064.91
    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 |   .0185667    .000569    32.63   0.000     .0174516    .0196819
           _cons |   1.120439   .0159154    70.40   0.000     1.089245    1.151632
    -------------+----------------------------------------------------------------
         sigma_u |  .36972456
         sigma_e |  .30349389
             rho |  .59743613   (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  14.529  Chi-sq(1)    P-value = 0.0001
    
    . xtreg ln_wage age, vce(cluster idcode) fe
    
    Fixed-effects (within) regression               Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1026                                         min =          1
         Between = 0.0877                                         avg =        6.1
         Overall = 0.0774                                         max =         15
    
                                                    F(1, 4709)        =     884.05
    corr(u_i, Xb) = 0.0314                          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 |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
           _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
    -------------+----------------------------------------------------------------
         sigma_u |  .40635023
         sigma_e |  .30349389
             rho |  .64192015   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . estimates store fe
    
    . xtreg ln_wage age, vce(cluster idcode) re
    
    Random-effects GLS regression                   Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1026                                         min =          1
         Between = 0.0877                                         avg =        6.1
         Overall = 0.0774                                         max =         15
    
                                                    Wald chi2(1)      =    1064.91
    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 |   .0185667    .000569    32.63   0.000     .0174516    .0196819
           _cons |   1.120439   .0159154    70.40   0.000     1.089245    1.151632
    -------------+----------------------------------------------------------------
         sigma_u |  .36972456
         sigma_e |  .30349389
             rho |  .59743613   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . estimates store re
    
    . rhausman fe re, reps(200) cluster
    bootstrap in progress
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    .................................................. 50
    (This bootstrap will approximately take another 0h. 0min. 33sec.)
    .................................................. 100
    .................................................. 150
    .................................................. 200
    --------------------------------------------------------------------------------
    Cluster-Robust Hausman Test
    (based on 200 bootstrap repetitions)
    
    b1: obtained from xtreg ln_wage age, vce(cluster idcode) fe                     
    b2: obtained from xtreg ln_wage age, vce(cluster idcode) re                     
    
        Test:  Ho:  difference in coefficients not systematic
    
                      chi2(1) = (b1-b2)' * [V_bootstrapped(b1-b2)]^(-1) * (b1-b2)
                              =       12.76
                    Prob>chi2 =      0.0004
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #17
      Eduardo:
      Thank you very much. The -estat mundlak- command gives me the exact same numbers (and decision) as xtoverid would. I will apply a FE regression accordingly. Best Regards, Eduard
      Last edited by Eduard Kepl; 08 May 2025, 03:01.

      Comment


      • #18
        Carlo:
        Thank you very much for providing the example. I cannot tell why in my case or the example of Cengiz, the two commands contradict. As the results of xtoverid are confirmed by the mundlak test and generally the xtoverid command seems to be more common, I will use a FE model for my research. All the best, Eduard

        Comment

        Working...
        X