Announcement

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

  • ivreghdfe standard errors

    Dear all,

    I am trying to use ivreghdfe to replicate the results from ivregress and ivreg2 (ssc install ivreg2).

    ivreghdfe was installed from here: https://github.com/sergiocorreia/ivreghdfe#installation

    Code:
    sysuse auto
    ivregress 2sls price weight (length=gear) i.rep78
    ivreg2 price weight (length=gear) i.rep78
    ivreghdfe price weight (length=gear), absorb(rep78)
    We can obtain exactly the same estimates, but the standard errors from ivreghdfe differ from the others.
    Could anyone explain why this difference occurs? Any suggestions would be appreciated.

  • #2
    By default, ivregress and ivreg2 report z-statistics, whereas ivreghdfe always reports t-statistics. When the sample size is small, you may notice some differences in the standard errors, since z-statistics rely on large-sample approximations. If you are working with a relatively small sample, you can add the option -small- to either ivregress or ivreg2 to report t-statistics.

    Code:
    sysuse auto, clear
    ivregress 2sls price weight (length=gear) i.rep78, small
    ivreg2 price weight (length=gear) i.rep78, small
    ivreghdfe price weight (length=gear), absorb(rep78)
    Res.:

    Code:
    . ivregress 2sls price weight (length=gear) i.rep78, small
    
    
    Instrumental-variables 2SLS regression
    
          Source |       SS       df       MS         Number of obs   =         69
    -------------+------------------------------      F(  6,    62)   =       3.84
           Model |   8799835.9     6  1466639.32      Prob > F        =     0.0025
        Residual |   567997123    62  9161243.92      R-squared       =     0.0153
    -------------+------------------------------      Adj R-squared   =    -0.0800
           Total |   576796959    68  8482308.22      Root MSE        =     3026.8
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          length |   156.4453   345.4758     0.45   0.652    -534.1511    847.0417
          weight |  -1.899938   9.598611    -0.20   0.844    -21.08729    17.28741
                 |
           rep78 |
              2  |   262.1144   2659.123     0.10   0.922    -5053.397    5577.626
              3  |   1460.595   2220.161     0.66   0.513    -2977.445    5898.634
              4  |    1721.87   2385.178     0.72   0.473    -3046.033    6489.772
              5  |   2815.746    2545.01     1.11   0.273    -2271.657    7903.148
                 |
           _cons |  -19113.85   35683.95    -0.54   0.594    -90445.05    52217.35
    ------------------------------------------------------------------------------
    Endogenous: length
    Exogenous:  weight 2.rep78 3.rep78 4.rep78 5.rep78 gear_ratio
    
    .
    . ivreg2 price weight (length=gear) i.rep78, small
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =       69
                                                          F(  6,    62) =     3.84
                                                          Prob > F      =   0.0025
    Total (centered) SS     =  576796958.9                Centered R2   =   0.0153
    Total (uncentered) SS   =   3183192639                Uncentered R2 =   0.8216
    Residual SS             =    567997123                Root MSE      =     3027
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          length |   156.4453   345.4758     0.45   0.652    -534.1511    847.0417
          weight |  -1.899938   9.598611    -0.20   0.844    -21.08729    17.28741
                 |
           rep78 |
              2  |   262.1144   2659.123     0.10   0.922    -5053.397    5577.626
              3  |   1460.595   2220.161     0.66   0.513    -2977.445    5898.634
              4  |    1721.87   2385.178     0.72   0.473    -3046.033    6489.772
              5  |   2815.746    2545.01     1.11   0.273    -2271.657    7903.148
                 |
           _cons |  -19113.85   35683.95    -0.54   0.594    -90445.05    52217.35
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):           1.551
                                                       Chi-sq(1) P-val =    0.2130
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):                1.425
    Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                             15% maximal IV size              8.96
                                             20% maximal IV size              6.66
                                             25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):           0.000
                                                     (equation exactly identified)
    ------------------------------------------------------------------------------
    Instrumented:         length
    Included instruments: weight 2.rep78 3.rep78 4.rep78 5.rep78
    Excluded instruments: gear_ratio
    ------------------------------------------------------------------------------
    
    .
    . ivreghdfe price weight (length=gear), absorb(rep78)
    (MWFE estimator converged in 1 iterations)
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =       69
                                                          F(  2,    62) =    11.08
                                                          Prob > F      =   0.0001
    Total (centered) SS     =  568436416.2                Centered R2   =   0.0008
    Total (uncentered) SS   =  568436416.2                Uncentered R2 =   0.0008
    Residual SS             =    567997123                Root MSE      =     3027
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          length |   156.4453   345.4758     0.45   0.652    -534.1511    847.0417
          weight |  -1.899938   9.598611    -0.20   0.844    -21.08729    17.28741
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):           1.551
                                                       Chi-sq(1) P-val =    0.2130
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):                1.425
    Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                             15% maximal IV size              8.96
                                             20% maximal IV size              6.66
                                             25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):           0.000
                                                     (equation exactly identified)
    ------------------------------------------------------------------------------
    Instrumented:         length
    Included instruments: weight
    Excluded instruments: gear_ratio
    Partialled-out:       _cons
                          nb: total SS, model F and R2s are after partialling-out;
                              any small-sample adjustments include partialled-out
                              variables in regressor count K
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
           rep78 |         5           0           5     |
    -----------------------------------------------------+
    
    .
    Last edited by Andrew Musau; 03 Sep 2025, 23:27.

    Comment

    Working...
    X