Announcement

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

  • ivreghdfe exporting F statistics from first stage

    Hello,
    I am running the following specification using ivreg

    Code:
    eststo: ivreghdfe Y (endogenous endogenous2 = Z Z2 ), a(year) first savefirst savefprefix(st1)
    estadd scalar fst = `e(rkf)': st1endogenous
    estadd scalar fst2 = `e(rkf)': st1endogenous2
    I am trying to export the first stage F-stat for my two instruments, which are displayed in output as below:
    Click image for larger version

Name:	Screen Shot 2022-12-04 at 12.23.15 PM.png
Views:	3
Size:	62.0 KB
ID:	1692012

    But when I etreturn list, I cannot find them. Where are the first-stage F statistics stored that I could use to export?
    Attached Files

  • #2
    ivreghdfe and estout are from SSC, as you are asked to explain (FAQ Advice #12). See #6: https://www.statalist.org/forums/for...-stage-outcome

    Comment


    • #3
      Thanks for the reminder, Andrew. Yes stout and ivreghdfe are from SSC, using Stata 17.

      And thanks for the link to the related post. However, it's not the statistics stored in e(cdf) or e(sttat) that I would like to export, which are 11560 and 3.3 respectively, but the values shown in the screenshot above. I'm still not understanding where those values might be stored.

      Comment


      • #4
        The idea is to reproduce the statistics from the first-stage(s) if they are not included in the stored results. At some point, you need to try and understand what the code is doing.

        Code:
        webuse nlswork, clear
        ivreghdfe ln_w age c.age#c.age not_smsa (tenure = union south), absorb(id) first
        g sample = e(sample)
        local excluded= e(exexog)
        reghdfe `e(instd)' `e(insts)' if sample, absorb(`e(absvars)')
        test `excluded'
        Res.:

        Code:
        . ivreghdfe ln_w age c.age#c.age not_smsa (tenure = union south), absorb(id) first
        (dropped 673 singleton observations)
        (MWFE estimator converged in 1 iterations)
        
        First-stage regressions
        -----------------------
        
        
        First-stage regression of tenure:
        
        Statistics consistent for homoskedasticity only
        Number of obs =                  18334
        ------------------------------------------------------------------------------
              tenure |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               union |   .3896861   .0706568     5.52   0.000     .2511901    .5281821
               south |  -.4296172   .1349122    -3.18   0.001    -.6940618   -.1651726
                 age |   .0863031   .0343238     2.51   0.012     .0190241    .1535821
                     |
         c.age#c.age |   .0039115    .000549     7.12   0.000     .0028353    .0049876
                     |
            not_smsa |  -.3552488   .1269318    -2.80   0.005    -.6040507   -.1064468
        ------------------------------------------------------------------------------
        F test of excluded instruments:
          F(  2, 14868) =    21.29
          Prob > F      =   0.0000
        Sanderson-Windmeijer multivariate F test of excluded instruments:
          F(  2, 14868) =    21.29
          Prob > F      =   0.0000
        
        
        
        Summary results for first-stage regressions
        -------------------------------------------
        
                                                   (Underid)            (Weak id)
        Variable     | F(  2, 14868)  P-val | SW Chi-sq(  2) P-val | SW F(  2, 14868)
        tenure       |      21.29    0.0000 |       52.50   0.0000 |       21.29
        
        Stock-Yogo weak ID F test critical values for single endogenous regressor:
                                           10% maximal IV size             19.93
                                           15% maximal IV size             11.59
                                           20% maximal IV size              8.75
                                           25% maximal IV size              7.25
        Source: Stock-Yogo (2005).  Reproduced by permission.
        NB: Critical values are for Sanderson-Windmeijer F statistic.
        
        Underidentification test
        Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
        Ha: matrix has rank=K1 (identified)
        Anderson canon. corr. LM statistic       Chi-sq(2)=52.35    P-val=0.0000
        
        Weak identification test
        Ho: equation is weakly identified
        Cragg-Donald Wald F statistic                                      21.29
        
        Stock-Yogo weak ID test critical values for K1=1 and L1=2:
                                           10% maximal IV size             19.93
                                           15% maximal IV size             11.59
                                           20% maximal IV size              8.75
                                           25% maximal IV size              7.25
        Source: Stock-Yogo (2005).  Reproduced by permission.
        
        Weak-instrument-robust inference
        Tests of joint significance of endogenous regressors B1 in main equation
        Ho: B1=0 and orthogonality conditions are valid
        Anderson-Rubin Wald test           F(2,14868)=   126.26     P-val=0.0000
        Anderson-Rubin Wald test           Chi-sq(2)=    311.39     P-val=0.0000
        Stock-Wright LM S statistic        Chi-sq(2)=    306.19     P-val=0.0000
        
        Number of observations               N  =      18334
        Number of regressors                 K  =          4
        Number of endogenous regressors      K1 =          1
        Number of instruments                L  =          5
        Number of excluded instruments       L1 =          2
        
        IV (2SLS) estimation
        --------------------
        
        Estimates efficient for homoskedasticity only
        Statistics consistent for homoskedasticity only
        
                                                              Number of obs =    18334
                                                              F(  4, 14869) =    74.14
                                                              Prob > F      =   0.0000
        Total (centered) SS     =  1119.473248                Centered R2   =  -4.2766
        Total (uncentered) SS   =  1119.473248                Uncentered R2 =  -4.2766
        Residual SS             =  5907.007821                Root MSE      =    .6303
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
              tenure |   .2403531   .0373419     6.44   0.000     .1671583    .3135478
                 age |   .0118437   .0090032     1.32   0.188    -.0058037    .0294912
                     |
         c.age#c.age |  -.0012145   .0001968    -6.17   0.000    -.0016003   -.0008286
                     |
            not_smsa |  -.0167178   .0339236    -0.49   0.622    -.0832123    .0497767
        ------------------------------------------------------------------------------
        Underidentification test (Anderson canon. corr. LM statistic):          52.345
                                                           Chi-sq(2) P-val =    0.0000
        ------------------------------------------------------------------------------
        Weak identification test (Cragg-Donald Wald F statistic):               21.286
        Stock-Yogo weak ID test critical values: 10% maximal IV size             19.93
                                                 15% maximal IV size             11.59
                                                 20% maximal IV size              8.75
                                                 25% maximal IV size              7.25
        Source: Stock-Yogo (2005).  Reproduced by permission.
        ------------------------------------------------------------------------------
        Sargan statistic (overidentification test of all instruments):           1.691
                                                           Chi-sq(1) P-val =    0.1935
        ------------------------------------------------------------------------------
        Instrumented:         tenure
        Included instruments: age c.age#c.age not_smsa
        Excluded instruments: union south
        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 |
        -------------+---------------------------------------|
              idcode |      3461           0        3461     |
        -----------------------------------------------------+
        
        . 
        . g sample = e(sample)
        
        . 
        . local excluded= e(exexog)
        
        . 
        . reghdfe `e(instd)' `e(insts)' if sample, absorb(`e(absvars)')
        (MWFE estimator converged in 1 iterations)
        
        HDFE Linear regression                            Number of obs   =     18,334
        Absorbing 1 HDFE group                            F(   5,  14868) =    1285.83
                                                          Prob > F        =     0.0000
                                                          R-squared       =     0.6832
                                                          Adj R-squared   =     0.6094
                                                          Within R-sq.    =     0.3019
                                                          Root MSE        =     2.5870
        
        ------------------------------------------------------------------------------
              tenure |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               union |   .3896861   .0706568     5.52   0.000     .2511901    .5281821
               south |  -.4296172   .1349122    -3.18   0.001    -.6940618   -.1651726
                 age |   .0863031   .0343238     2.51   0.012     .0190241    .1535821
                     |
         c.age#c.age |   .0039115    .000549     7.12   0.000     .0028353    .0049876
                     |
            not_smsa |  -.3552488   .1269318    -2.80   0.005    -.6040507   -.1064468
               _cons |  -2.498797   .5297226    -4.72   0.000    -3.537118   -1.460475
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        -----------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
        -------------+---------------------------------------|
              idcode |      3461           0        3461     |
        -----------------------------------------------------+
        
        . 
        . test `excluded'
        
         ( 1)  union = 0
         ( 2)  south = 0
        
               F(  2, 14868) =   21.29
                    Prob > F =    0.0000
        
        .

        Comment

        Working...
        X