Announcement

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

  • Dear Prof Sebasian

    In my research model i have used system GMM (using xtdpgmm command) since the dependent variable in my study can be influenced by its past values, there exists heteroskedasticity and autocorrelation issue. Further, few of the explanotory variables are also influenced by unobserved factors and have a reverse causality effect on my dependent variable.

    I would like to know that besides the post estimation tests of Arellano & Bond and Sargan-Hansen, do we also need to perform endogeneity test (Durbin-Wu-Hausman Test).

    Thank You.

    Comment


    • The Durbin-Wu-Hausman test is not of much use in such dynamic panel models because there are multiple regressors that we can rule out to be strictly exogenous from the very beginning. It is more common in the empirical practice to use incremental overidentification tests (Difference-in-Hansen tests) to check the assumptions behind specific variables.
      https://twitter.com/Kripfganz

      Comment


      • A minor update to version 2.6.7 is available for the xtdpdgmm package:
        Code:
        net install xtdpdgmm, from(http://www.kripfganz.de/stata/) replace
        While old do-files continue to run, the postestimation command estat serialpm is now no longer documented. It is superseded by the new standalone package xtdpdserial, which can be used as a postestimation command after xtdpdgmm.
        https://twitter.com/Kripfganz

        Comment


        • Dear Professor @Sebastian Kripfganz

          I have a quick question. At the link below, you mention that:

          1. A coefficient of the lagged dependent variable slightly above 1, but not significantly different from 1, can happen in empirical work. It could be a characteristic of the data and does not necessarily imply that there is anything wrong.
          https://www.statalist.org/forums/for...08#post1511708

          Can you please provide some insight into this in the context of the system-gmm? Could you kindly point to some references where this is indicated? I just want to make sure I am able to preempt reviewer pushback on this matter.

          Thank you in advance!

          Comment


          • Some of the instruments can become irrelevant when the true autoregressive coefficient is 1 (especially those for a difference GMM estimator), but with system GMM there are usually enough relevant instruments (although there is the risk that many of them might be weak). A relevant reference is the following:
            https://twitter.com/Kripfganz

            Comment


            • Dear Professor @Sebastian Kripfganz
              Thank you very much!

              Comment


              • Dear Professor @Sebastian Kripfganz

                I have some follow-up questions. For pedagogical purposes, I am trying to understand how to replicate various specifications of xtdpdgmm with both xtabond2 and ivereg2, and vice versa. Specifically, I would like to know how to replicate the specifications below with xtdpdgmm and Stata’s native “gmm” command. I am aware that the following specifications make the incorrect assumption of homoskedasticity:

                Code:
                webuse abdata, clear
                
                xtabond2 L(0/1).n (yr1978 - yr1984) w k, ///
                 gmm(L.n , lag(1 2) eq(diff) passthru)  iv(yr1978 - yr1984 w k, eq(diff) passthru) ///
                 nocons nolevel cluster(id) twostep ar(4) h(1)
                estimate store m_xtabond2
                
                * Replicate above results using ivreg2 exclusively
                * Create gmm-style instruments
                foreach var of varlist n {
                   forvalues lag = 2(1)3 {
                      capture drop il`lag'`var'
                      gen il`lag'`var' = L`lag'.`var'
                      replace il`lag'`var' = 0 if il`lag'`var' ==.
                 
                      foreach year of varlist yr1978- yr1984 {
                            capture drop i`year'l`lag'`var' 
                            gen i`year'l`lag'`var' = `year' * il`lag'`var'
                            replace i`year'l`lag'`var' = 0 if i`year'l`lag'`var'  == .          
                }
                    drop il`lag'`var' 
                }
                }
                
                sum iyr*
                * Drop all gmm-style instruments that are always "0"
                findname, all(@==0)
                drop `r(varlist)'
                
                
                ivreg2  D.n yr1978 - yr1984 (D.L.n D.w D.k  = iyr* w k), gmm2s nocons cluster(id) 
                estimate store m_ivreg2_gmm2s
                
                esttab  m_xtabond2 m_ivreg2_gmm2s, order(L.n LD.n w D.w  k D.k) b(7) se(8)
                With the results below

                HTML Code:
                --------------------------------------------
                                      (1)             (2)   
                                        n             D.n   
                --------------------------------------------
                L.n             0.1248564                   
                             (0.26002198)                   
                
                LD.n                            0.1248564   
                                             (0.12566118)   
                
                w              -1.0278240**                 
                             (0.32938896)                   
                
                D.w                            -1.0278240***
                                             (0.19269549)   
                
                k               0.6161085*                  
                             (0.25809647)                   
                
                D.k                             0.6161085***
                                             (0.14412866)   
                
                yr1978         -0.0490880**    -0.0490880***
                             (0.01844949)    (0.01429634)   
                
                yr1979         -0.0608093*     -0.0117213   
                             (0.02464175)    (0.00994148)   
                
                yr1980         -0.0716865***   -0.0108772   
                             (0.02055941)    (0.01055265)   
                
                yr1981         -0.0870178***   -0.0153313   
                             (0.02482253)    (0.01516805)   
                
                yr1982         -0.0650888*      0.0219290   
                             (0.03236609)    (0.01593615)   
                
                yr1983         -0.0343555       0.0307333*  
                             (0.04061727)    (0.01495625)   
                
                yr1984         -0.0190336       0.0153218   
                             (0.04712421)    (0.01630749)   
                --------------------------------------------
                N                     751             751   
                --------------------------------------------
                Standard errors in parentheses
                * p<0.05, ** p<0.01, *** p<0.001
                In short, I am able to reproduce the point estimates (not the SEs because ivreg2 does not allow for the Windmeijer correction) for "xtabond2, h(1)" using "ivreg2" exclusively, i.e. by creating the gmm-style instruments by hand. Again, my interest in doing so is merely pedagogical and in order to understand the different specifications possible with each command. My questions are the following:

                1) Is it possible to replicate the estimates above with xtdpdgmm? What options would I need to use?

                2) Is it possible to replicate the estimates above with Stata’s native “gmm” command? What options would I need to use?

                3) Do you know of any options for ivreg2 that would result in the correct point estimates as those generated by the default options in xtdpdgmm? I understand that the SEs will always be smaller in ivreg2 because it cannot do the Windmeijer correction, but is it possible to obtain the correct point estimates?

                Thank you in advance for your guidance.

                Comment


                • The following xtdpdgmm specifications exactly replicates your estimates (the first with Windmeijer correction as in xtabond2, and the second without as in ivreg2):
                  Code:
                  xtdpdgmm L(0/1).n w k, teffects model(diff) gmm(L.n, lag(1 2)) iv(w k) nocons nolevel vce(cluster id) twostep wmatrix(separate)
                  xtdpdgmm L(0/1).n w k, teffects model(diff) gmm(L.n, lag(1 2)) iv(w k) nocons nolevel twostep wmatrix(separate)
                  The following is the replication command line for gmm (although I am not sure whether it is possible to replicate standard errors):
                  Code:
                  gmm (D.n - {xb:DL.n D.w D.k yr1978-yr1984}), xtinstruments(L.n, lags(1 2)) instruments(w k yr1978-yr1984, nocons) winitial(xt L)
                  I am not sure what you are aiming for in your last question beyond the above replication. You will always have to generate the GMM-style instruments manually for ivreg2. The main reason is that you need to replace missing values by zeros to avoid those observations being dropped. xtdpdgmm produces those instruments as new variables with the postestimation command predict (with option iv), which can then be fed into ivreg2.
                  https://twitter.com/Kripfganz

                  Comment


                  • Dear Professor @Sebastian Kripfganz

                    Thank you for your help! I was not clear in my third question. What I meant to ask is whether it is possible to replicate the point estimates for xtdpdgmm with its default options using ivreg2 when the gmm-style instruments for ivreg2 are generatred by hand. For example:

                    Code:
                    
                    webuse abdata, clear
                    
                    /* xtdpdgmm with its defaults */
                    xtdpdgmm L(0/1).n  (yr1978- yr1984) w k,  model(diff) twostep nolevel nocons  gmm(L.n , l(1 1))  iv(yr1978- yr1984 w k)  vce(cluster id)
                    estimate store m1_xtdpdgmm
                    capture drop iv*
                    quietly predict iv*, iv
                    
                    ivreg2 n (L.n w k yr1978- yr1984 = iv*), gmm2s cluster(id) nocons
                    estimate store m1_ivreg2
                    
                    
                    
                    /* xtdpdgmm with "wmatrix(separate)" */
                    xtdpdgmm L(0/1).n  (yr1978- yr1984) w k,   model(diff) twostep nolevel nocons  gmm(L.n , l(1 1))  iv(yr1978- yr1984 w k)  vce(cluster id) wmatrix(separate)
                    estimate store m2_xtdpdgmm
                    
                    * Create "gmm-style" instruments by hand    
                    foreach var of varlist n {
                        di "`var'"
                        forvalues lag = 2(1)2 {
                            display `lag'
                             capture drop il`lag'`var'
                             gen il`lag'`var' = L`lag'.`var'
                             replace il`lag'`var' = 0 if il`lag'`var' ==.
                     
                    
                            foreach year of varlist yr1978- yr1984 {
                                capture drop i`year'l`lag'`var'
                                gen i`year'l`lag'`var' = `year' * il`lag'`var'
                                replace i`year'l`lag'`var' = 0 if i`year'l`lag'`var'  == .
                                
                    }
                        drop il`lag'`var'
                    }
                    }
                    
                    sum iyr*
                    
                    
                    ivreg2  D.n yr1978 - yr1984 (D.L.n D.w D.k  = iyr* w k), gmm2s nocons cluster(id)
                    estimate store m2_ivreg2
                    
                    
                    esttab  m1_xtdpdgmm m1_ivreg2 m2_xtdpdgmm m2_ivreg2, order(L.n LD.n w D.w  k D.k) b(7) se(8)
                    
                    
                    -----------------------------------------------------------------------------
                                          (1)             (2)             (3)             (4)  
                                            n               n               n             D.n  
                    ----------------------------------------------------------------------------
                    L.n             0.5506190       0.5506191**     0.4111800                  
                                 (0.30921166)    (0.20419585)    (0.26059471)                  
                    
                    LD.n                                                            0.4111800*  
                                                                                 (0.18245773)  
                    
                    w              -1.0048009**    -1.0048008***   -1.0111454**                
                                 (0.30828038)    (0.24825200)    (0.33363667)                  
                    
                    D.w                                                            -1.0111454***
                                                                                 (0.26820416)  
                    
                    k               0.2998862       0.2998862       0.3981729                  
                                 (0.21708074)    (0.15620364)    (0.22582202)                  
                    
                    D.k                                                             0.3981729*  
                                                                                 (0.16615589)  
                    
                    yr1978         -0.0309086*     -0.0309086*     -0.0351301*     -0.0351301**
                                 (0.01374235)    (0.01249613)    (0.01521336)    (0.01288389)  
                    
                    yr1979         -0.0388346*     -0.0388346*     -0.0433236*     -0.0081935  
                                 (0.01775684)    (0.01648030)    (0.02045487)    (0.00863804)  
                    
                    yr1980         -0.0585632***   -0.0585632***   -0.0630416***   -0.0197180  
                                 (0.01731379)    (0.01627237)    (0.01833015)    (0.01054987)  
                    
                    yr1981         -0.0950787***   -0.0950787***   -0.0925442***   -0.0295026  
                                 (0.02820044)    (0.02412458)    (0.02471889)    (0.01662232)  
                    
                    yr1982         -0.0621763*     -0.0621763*     -0.0631975*      0.0293467*  
                                 (0.02868215)    (0.02467994)    (0.02990375)    (0.01438922)  
                    
                    yr1983         -0.0079399      -0.0079399      -0.0160096       0.0471880**
                                 (0.02561728)    (0.02466424)    (0.03242727)    (0.01520720)  
                    
                    yr1984          0.0218494       0.0218494       0.0080898       0.0240994  
                                 (0.03371198)    (0.03195472)    (0.04064090)    (0.01903547)  
                    ----------------------------------------------------------------------------
                    N                     891             891             891             751  
                    ----------------------------------------------------------------------------
                    Standard errors in parentheses
                    * p<0.05, ** p<0.01, *** p<0.001

                    So, the first ivreg2 (m1_ivreg2) replicates xtdpdgmm with its defaults, while the second ivreg2 (m2_ivreg2) replicates xtdpdgmm with "wmatrix(separate)". My questions are:

                    1) Are there any options that can be added to the second "ivreg2" command (m2_ivreg2)--which has the gmm-style instruments generated by hand--so that it replicates the point estimates for "xtdpdgmm" with its defaults (m1_xtdpdgmm)?

                    2) Does "ivreg2" have any options that would allow it to make the Windmeijer correction in SE?

                    3) I noticed that the instruments generated by "predict, iv" after "xtdpdgmm" are similar, but not exactly the same as those generated by hand (please see below). The column "iv2" corresponds to an instrument created by "predict, iv" after "xtdpdgmm" whereas "iyr1979l2n" is the equivalent instrument created by the loop above. How can one make sense of a negative version of the lag in the preceding year in the "iv2" column?

                    Code:
                    clear
                    input float(id year iv2 iyr1979l2n)
                     1 1977          .          0
                     1 1978 -1.6176045          0
                     1 1979  1.6176045  1.6176045
                     1 1980          0          0
                     1 1981          0          0
                     1 1982          0          0
                     1 1983          0          0
                     2 1977          .          0
                     2 1978  -4.267163          0
                     2 1979   4.267163   4.267163
                     2 1980          0          0
                     2 1981          0          0
                     2 1982          0          0
                     2 1983          0          0
                     3 1977          .          0
                     3 1978  -2.952616          0
                     3 1979   2.952616   2.952616
                     3 1980          0          0
                     3 1981          0          0
                     3 1982          0          0
                     3 1983          0          0
                     4 1977          .          0
                     4 1978 -3.2642314          0
                     4 1979  3.2642314  3.2642314
                     4 1980          0          0
                     4 1981          0          0
                     4 1982          0          0
                     4 1983          0          0
                    Thank you for your always kind help!
                    Last edited by Arkangel Cordero; 31 Oct 2024, 17:25.

                    Comment


                    • We might be using different versions of ivreg2.
                      Code:
                      . which ivreg2
                      *! ivreg2 4.1.12  14aug2024
                      With your code, I actually cannot replicate the first xtdpdgmm results. This only works if I add the option nocollin to the ivreg2 command line:
                      Code:
                      xtdpdgmm L(0/1).n (yr1978-yr1984) w k, model(diff) twostep nolevel nocons gmm(L.n, l(1 1)) iv(yr1978-yr1984 w k) vce(cluster id)
                      estimate store m1_xtdpdgmm
                      capture drop iv*
                      quietly predict iv*, iv
                      
                      ivreg2 n (L.n w k yr1978-yr1984 = iv*), gmm2s cluster(id) nocons nocollin
                      I am still not sure what you mean by "defaults". To replicate the results with a different weighting matrix, you can supply this weighting matrix with the ivreg2 option wmatrix():
                      Code:
                      xtdpdgmm L(0/1).n (yr1978-yr1984) w k, model(diff) twostep nolevel nocons gmm(L.n, l(1 1)) iv(yr1978- yr1984 w k) vce(cluster id) wmatrix(separate)
                      estimate store m2_xtdpdgmm
                      capture drop iv*
                      quietly predict iv*, iv
                      local iv "`r(iv)'"
                      matrix W = e(W)
                      matrix roweq W = ""
                      matrix coleq W = ""
                      matrix rownames W = `iv'
                      matrix colnames W = `iv'
                      ivreg2 n (L.n w k yr1978-yr1984 = iv*), cluster(id) nocons nocollin wmatrix(W)
                      Note that in this example, the matrix W actually contains the optimal weighting matrix for the second step, which is why I have dropped the gmm2s option from ivreg2. Alternatively, you can obtain the initial weighting matrix from the one-step estimator:
                      Code:
                      xtdpdgmm L(0/1).n (yr1978-yr1984) w k, model(diff) twostep nolevel nocons gmm(L.n, l(1 1)) iv(yr1978- yr1984 w k) vce(cluster id) wmatrix(separate)
                      estimate store m2_xtdpdgmm
                      capture drop iv*
                      quietly predict iv*, iv
                      local iv "`r(iv)'"
                      quietly xtdpdgmm L(0/1).n (yr1978-yr1984) w k, model(diff) nolevel nocons gmm(L.n, l(1 1)) iv(yr1978- yr1984 w k) vce(cluster id) wmatrix(separate) onestep
                      matrix W = e(W)
                      matrix roweq W = ""
                      matrix coleq W = ""
                      matrix rownames W = `iv'
                      matrix colnames W = `iv'
                      ivreg2 n (L.n w k yr1978-yr1984 = iv*), gmm2s cluster(id) nocons nocollin wmatrix(W)
                      ivreg2 does not have an option for the Windmeijer correction.

                      The instruments creates by predict with option iv are transformed such that they always refer to the level model. Notice that in your replication of the first model, you did not specify the variables in first differences when using ivreg2. In contrast, when you created the instruments by hand, you then called ivreg2 with first-differenced variables. Please see slide 33 of my 2019 London Stata Conference presentation.
                      https://twitter.com/Kripfganz

                      Comment


                      • Dear Professor @Sebastian Kripfganz
                        Wow! Thank you so much for your help. Really helpful. I have two follow up questions:

                        1) Does the fact that ivreg2 cannot do the Windmeijer correction invalidate the diagnostics (under, weak and over identification tests) generated by this command after "xtdpdgmm, predict iv" ? From your 2019 London Stata Conference presentation, I infer this is not the case, but I just want to double check. Why is this not the case?

                        2) In your last response above, it seems that when estimating the difference gmm, xtdpdgmm estimates the model in levels and uses lagged differences as instruments. Is that correct? If so, I recall a previous discussion about this making the assumption that the fixed-effects are uncorrelated with the differences (changes in the levels). Is this only problematic in the "system" gmm? Why is it not a problem in the difference gmm? I apologize in advance if I am confusing things.

                        Thank you again.

                        Comment


                        • The Windmeijer correction is a finite-sample variance correction. Asymptotically, standard errors and any tests based on them are still valid without the correction.

                          No, the "difference GMM" estimator does not se lagged differences as instruments for the model in level. If you look again at your iv2 instrument in post #654, you will see that the lagged level (which is the value for year 1979) is repeated with a negative sign in the previous year. This is not a difference by itself, but it mechanically ensures that the sum over time multiplied by a constant (such as the fixed effect) equates to zero. In other words, the instrument is orthogonal to any time-invariant variable. This does not require any additional assumption about uncorrelatedness.
                          https://twitter.com/Kripfganz

                          Comment


                          • Dear Professor @Sebastian Kripfganz

                            Thank you for clarifying!

                            Comment


                            • Faut-il effectuer des tests de stationnarité avant d’effectuer la modélisation GMM ?

                              Comment


                              • These GMM estimators are intended for panels data sets with a relatively small number of time periods (T) and a relatively large number of cross sections (N). For such panel data, stationarity tests are usually not of much interest.
                                https://twitter.com/Kripfganz

                                Comment

                                Working...
                                X