Announcement

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

  • Weak IV test after Xtabond2

    Dear all,

    I am running an xtabond2 model and I wanted to see whether the instruments are weak.

    For example, we could use the examples of the help list that produce the same result by using xtabond2 and ivreg2.
    We could see that the Weak identification test (Cragg-Donald Wald F statistic) shows: "12.967" from the ivreg2 results

    How could I find the same statistic (or any other weak IV test statistics) after running xtabond2? I can find no such statistics in the return list.

    Thank you so much for the help,
    Alex


    . ivreg2 n cap (w = k ys rec) [pw=_n], cluster(id year) orthog(rec)
    (sum of wgt is 5.3200e+05)

    IV (2SLS) estimation
    --------------------

    Estimates efficient for homoskedasticity only
    Statistics robust to heteroskedasticity and clustering on id and year

    Number of clusters (id) = 140 Number of obs = 1031
    Number of clusters (year) = 9 F( 2, 8) = 5.46
    Prob > F = 0.0320
    Total (centered) SS = 1814.255388 Centered R2 = -0.7793
    Total (uncentered) SS = 2579.501789 Uncentered R2 = -0.2515
    Residual SS = 3228.188635 Root MSE = 1.769

    ------------------------------------------------------------------------------
    | Robust
    n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    w | 4.685126 2.751587 1.70 0.089 -.7078855 10.07814
    cap | .0918093 .0459613 2.00 0.046 .0017268 .1818918
    _cons | -13.97191 8.653087 -1.61 0.106 -30.93165 2.987827
    ------------------------------------------------------------------------------
    Underidentification test (Kleibergen-Paap rk LM statistic): 3.033
    Chi-sq(3) P-val = 0.3866
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic): 12.967
    (Kleibergen-Paap rk Wald F statistic): 1.445
    Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 13.91
    10% maximal IV relative bias 9.08
    20% maximal IV relative bias 6.46
    30% maximal IV relative bias 5.39
    10% maximal IV size 22.30
    15% maximal IV size 12.83
    20% maximal IV size 9.54
    25% maximal IV size 7.80
    Source: Stock-Yogo (2005). Reproduced by permission.
    NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
    ------------------------------------------------------------------------------
    Hansen J statistic (overidentification test of all instruments): 6.099
    Chi-sq(2) P-val = 0.0474
    -orthog- option:
    Hansen J statistic (eqn. excluding suspect orthog. conditions): 5.174
    Chi-sq(1) P-val = 0.0229
    C statistic (exogeneity/orthogonality of suspect instruments): 0.924
    Chi-sq(1) P-val = 0.3363
    Instruments tested: rec
    ------------------------------------------------------------------------------
    Instrumented: w
    Included instruments: cap
    Excluded instruments: k ys rec
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    . xtabond2 n w cap [pw=_n], iv(cap k ys, eq(level)) iv(rec, eq(level)) cluster(
    > id year) h(1)
    Favoring speed over space. To switch, type or click on mata: mata set matafavor
    > space, perm.
    (sum of weights is 531996)

    Dynamic panel-data estimation, one-step system GMM
    ------------------------------------------------------------------------------
    Group variable: id Number of obs = 1031
    Time variable : year Number of groups = 140
    Number of instruments = 5 Obs per group: min = 7
    Wald chi2(.) = 58.07 avg = 7.36
    Prob > chi2 = . max = 9
    (Std. Err. adjusted for clustering on id year)
    ------------------------------------------------------------------------------
    | Robust
    n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    w | 4.685126 2.751587 1.70 0.089 -.7078855 10.07814
    cap | .0918093 .0459613 2.00 0.046 .0017268 .1818918
    _cons | -13.97191 8.653087 -1.61 0.106 -30.93165 2.987827
    ------------------------------------------------------------------------------
    Instruments for levels equation
    Standard
    rec
    cap k ys
    _cons
    ------------------------------------------------------------------------------
    Arellano-Bond test for AR(1) in first differences: z = -0.77 Pr > z = 0.443
    Arellano-Bond test for AR(2) in first differences: z = -0.30 Pr > z = 0.763
    ------------------------------------------------------------------------------
    Sargan test of overid. restrictions: chi2(2) = 265.93 Prob > chi2 = 0.000
    (Not robust, but not weakened by many instruments.)
    Hansen test of overid. restrictions: chi2(2) = 6.10 Prob > chi2 = 0.047
    (Robust, but weakened by many instruments.)

    Difference-in-Hansen tests of exogeneity of instrument subsets:
    iv(rec, eq(level))
    Hansen test excluding group: chi2(1) = 5.17 Prob > chi2 = 0.023
    Difference (null H = exogenous): chi2(1) = 0.92 Prob > chi2 = 0.336

  • #2
    Slides 39 and following of my 2019 London Stata Conference presentation provide an example of how to get all the statistics from ivreg2 after a system GMM estimation with my xtdpdgmm command (as an alternative to xtabond2): Alternatively, the weakiv command my be useful.
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Check the documentation for the user-written weakiv command. It supports xtabond2.

      Comment


      • #4
        Originally posted by Sebastian Kripfganz View Post
        Slides 39 and following of my 2019 London Stata Conference presentation provide an example of how to get all the statistics from ivreg2 after a system GMM estimation with my xtdpdgmm command (as an alternative to xtabond2):Alternatively, the weakiv command may be useful.
        Thank you for your help, Sebastian! I will check out the xtdpdgmm command.
        I have the following question about using weakiv command, the following two methods produce the same results. But the Anderson-Rubin test of ivreg2 and weakiv after xtabond2 give me different statistics (the bold line). Any idea why is this the case?
        I just wanted to make sure using weakiv will produce the right statistics.

        Thank you again for your help!

        . use http://www.stata-press.com/data/r7/abdata.dta

        . qui: ivreg2 n cap (w = k ys rec) [pw=_n], orthog(rec) first sfirst ffirst

        . di e(archi2)
        2051.8972


        . di e(archi2p)
        0

        . qui: xtabond2 n w cap [pw=_n], iv(cap k ys, eq(level)) iv(rec, eq(level)) h(1) svmat

        . weakiv
        Estimation using xtabond2-transformed data:
        Number of obs: diff eqn = 0, lev eqn = 1031, total = 1031
        Number of vars: #endog = 1, #inexog = 2, #exexog = 3
        Endog regressors: w
        Exog regressors: cap _cons
        (sum of wgt is 1.2996e+06)
        Estimating confidence sets over 100 grid points
        ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
        .................................................. 50
        .................................................. 100

        Weak instrument robust tests and confidence sets for linear IV
        H0: beta[n:w] = 0
        ------------------------------------------------------------------------------
        Test | Statistic p-value | Conf. level Conf. Set
        ------+---------------------------------+-------------------------------------
        CLR | stat(.) = 37.58 0.0000 | 95% [ 11.791, ... ]
        K | chi2(1) = 13.56 0.0002 | 95%
        [-2.42078,-1.51844] U [ 11.3399, ... ]
        J | chi2(2) = 27.20 0.0000 | 95% [ 6.82818, ... ]
        K-J | <n.a.> 0.0000 | 95% (96%,99%) [ 10.8887, ... ]
        AR | chi2(3) = 40.76 0.0000 | 95% [ 12.0166, ... ]
        ------+---------------------------------+-------------------------------------
        Wald | chi2(1) = 2.71 0.1000 | 95% [-.898085, 10.2683]
        ------------------------------------------------------------------------------
        Confidence sets estimated for 100 points in [ -6.4813, 15.8515].
        Number of obs N = 1031. Number of groups = 140; avg obs per group = 7.4.
        Method = lagrange multiplier (LM). Weight on K in K-J test = 0.800.
        Tests robust to heteroskedasticity and clustering on id (N_clust=140).
        Wald statistic in last row is based on xtabond2 estimation and is not robust to weak
        instruments.

        Comment


        • #5
          Originally posted by David Roodman View Post
          Check the documentation for the user-written weakiv command. It supports xtabond2.
          Thank you, David! I never would've imagined I could get a reply from the author himself!
          A follow-up question for using weakiv, it does not give me the same statistics as the ivreg2 for the weak IV test (Anderson-Rubin test). You could see an example in the post I replied to Sebastian.
          Any idea why is this the case, I could very well miss something very important here.
          Thank you so much for your help!

          Comment


          • #6
            I am afraid I cannot explain the discrepancies. Notice that you even get another result when you run the weakiv command after ivreg2:
            Code:
            . qui ivreg2 n cap (w = k ys rec) [pw=_n], orthog(rec) first sfirst ffirst
            
            . weakiv
            (sum of wgt is     5.3200e+05)
            Estimating confidence sets over 100 grid points
            ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
            ..................................................    50
            ..................................................   100
            
            Weak instrument robust tests and confidence sets for linear IV
            H0: beta[n:w] = 0
            ------------------------------------------------------------------------------
             Test |       Statistic         p-value |  Conf. level        Conf. Set      
            ------+---------------------------------+-------------------------------------
              CLR | stat(.)   =   204.44     0.0000 |      95%             null set      
                K | chi2(1)   =    72.77     0.0000 |      95%             null set      
                J | chi2(2)   =   167.50     0.0000 |      95%             null set      
              K-J |        <n.a.>            0.0000 | 95% (96%,99%)        null set      
               AR | chi2(3)   =   240.28     0.0000 |      95%             null set      
            ------+---------------------------------+-------------------------------------
             Wald | chi2(1)   =    21.07     0.0000 |      95%       [ 2.68449, 6.68576]  
            ------------------------------------------------------------------------------
            Confidence sets estimated for 100 points in [ .68386, 8.68639].
            Number of obs N = 1031.
            Method = lagrange multiplier (LM).  Weight on K in K-J test = 0.800.
            Tests robust to heteroskedasticity.
            Wald statistic in last row is based on ivreg2 estimation and is not robust to weak instruments.
            This might be a question for the authors of weakiv, e.g. Mark Schaffer
            https://www.kripfganz.de/stata/

            Comment


            • #7
              Worth distinguishing here between weak-IV-robust inference (provided by weakiv) and pre-tests for the presence of weak instruments, which was the original question.

              Last time I checked (but the theory keeps moving so don't take my word for it), the theory for pre-tests of weak instruments has been worked out in various ways for the iid case and for the single-endogenous-regressor non-iid case (the Montiel Olea and Pflueger 2013 test, implemented in the Stata command weakivtest by Pflueger and Wang). This is a bit of a problem for DPD/GMM estimation because you typically have multiple endogenous regressors.

              A fall-back here is to test for underidentification, which can be done using the Stata command underid. This will work after xtabond2 or xtdpdgmm. If you reject underidentification, you might still have a weak identification problem. But if you fail to reject even underidentification ... you probably have a weak identification problem too.

              The weakiv vs ivreg2 discrepancy above is because weakiv reports an LM version by default. If you use the md option with weakiv (minimum distance; for linear models, it's a Wald test), the AR test stat should match that reported by ivreg2.

              Comment


              • #8
                Originally posted by Mark Schaffer View Post
                Worth distinguishing here between weak-IV-robust inference (provided by weakiv) and pre-tests for the presence of weak instruments, which was the original question.

                Last time I checked (but the theory keeps moving so don't take my word for it), the theory for pre-tests of weak instruments has been worked out in various ways for the iid case and for the single-endogenous-regressor non-iid case (the Montiel Olea and Pflueger 2013 test, implemented in the Stata command weakivtest by Pflueger and Wang). This is a bit of a problem for DPD/GMM estimation because you typically have multiple endogenous regressors.

                A fall-back here is to test for underidentification, which can be done using the Stata command underid. This will work after xtabond2 or xtdpdgmm. If you reject underidentification, you might still have a weak identification problem. But if you fail to reject even underidentification ... you probably have a weak identification problem too.

                The weakiv vs ivreg2 discrepancy above is because weakiv reports an LM version by default. If you use the md option with weakiv (minimum distance; for linear models, it's a Wald test), the AR test stat should match that reported by ivreg2.
                Thank you so much for your reply, Mark!

                Could I still use weakiv as a reference to say IV is not weak after xtabond2? I have an intuition that the statistics that weakiv produces are going to be smaller than pre-tests for the presence of weak instruments.

                For example in this example above
                e(archi2)= 2051.8972 VS weakiv: AR | chi2(3) = 240.28.

                So if I could say weak IV is unlikely to be an issue using statatics that weakiv produced, using the statistics from the pre-test should give us the same story, since the statistics are likely to be bigger (my intuition, again).

                Or, do you think the best I could infer from about weak iv issue is doing the underidentification test, after xtabond2 or xtdpdgmm?

                Thank you again for your help!

                Comment


                • #9
                  Maybe a misunderstanding here (partly my fault). The AR test reported by ivreg2 is a weak-identification-robust test of the point null H0: beta=0. This is the same test reported by weakiv and you will get the same test statistic (if you use the right combination of options etc.). The advantage of weakiv is that you get a weak-identification-robust confidence interval. Much more useful imho. It is not, however, "a test for weak identification".

                  If you want to do a test of whether the model is weakly identified, that's a different null. You have a problem here, though, because the theory for the non-iid multiple-endogenous-regressor case hasn't been worked out (I think).

                  If yo want to do a test of whether the model is underidentified, that's a different null again. Here you can use the underid command to do the test.

                  Comment

                  Working...
                  X