Announcement

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

  • Sure. I have shared the data with you on email. Thank you so much, Prof. Kripfganz for your selfless involvement and support.

    Comment


    • Originally posted by Prateek Bedi View Post
      Sure. I have shared the data with you on email. Thank you so much, Prof. Kripfganz for your selfless involvement and support.
      Thank you very much for sending me your data set which helped me locating the problem in the code. From a technical perspective, the problem is as follows: It turns out that the functionality of the Mata function uniqrows() was extended in Stata 14.2 and for some calculation I rely on the added functionality. I believe you are using an older Stata version than 14.2 which caused the error message. I did not notice that before, because the problem in the code did not cause a compile-time error but only a run-time error under earlier Stata versions.

      Unfortunately, there is no easy fix to the problem for older versions of Stata. The new version 2.2.4 of xtdpdgmm that is now available for installation from my website now simply skips the problematic part of the code under Stata versions older than 14.2. The consequence is that with option overid the incremental overidentification tests are no longer computed for all instruments that are specified for the same model transformation, e.g. all instruments for model(level) or all instruments for model(fodev). They are still computed for each separate set of instruments as specified with the gmm() or iv() options. In the example from slide 52 of my London Stata Conference presentation, the final table would then look as follows:
      Code:
      . estat overid, difference
      
      Sargan-Hansen (difference) test of the overidentifying restrictions
      H0: (additional) overidentifying restrictions are valid
      
      2-step weighting matrix from full model
      
                        | Excluding                   | Difference                  
      Moment conditions |       chi2     df         p |        chi2     df         p
      ------------------+-----------------------------+-----------------------------
         1, model(diff) |    14.6666      6    0.0230 |      1.5296      3    0.6754
         2, model(diff) |     4.0234      3    0.2590 |     12.1728      6    0.0582
        3, model(level) |    15.8404      8    0.0447 |      0.3558      1    0.5509
        4, model(level) |    12.0861      7    0.0978 |      4.1102      2    0.1281
      I.e., the final two rows from the presentation slides are missing.

      Under Stata 14.2 or newer, nothing has changed.
      https://www.kripfganz.de/stata/

      Comment


      • Thanks for updating the command, Prof. Kripfganz. It is working fine now. Really appreciate your effort!

        Comment


        • Hello,

          I need help to read and interpret the output below corresponding to difference-in-Hansen tests for my model. I share this in light of the fact that the overall Sargan-Hansen test of my model is not getting satisfied despite trying many combinations of model specification.

          Code:
          xtdpdgmm Profitability4 L.Profitability4 Size2 AgeoftheFirm Leverage1 CurrentRatio SalesGro CapitalExpenditure2 WPromoterSharesin1 AD_Totalremuneration , teffects twostep vce(cluster CompanyID) gmmiv(L.Profitability4 , lag(1 4) model(fodev)) gmmiv(Leverage1 CurrentRatio CapitalExpenditure2, lag(1 4) model(fodev)) gmmiv(AD_Totalremuneration, lag(0 1) coll model(fodev)) gmmiv(Size2, lag(1 3) coll model(fodev)) iv(AgeoftheFirm, lag(1 1) model(fodev)) gmmiv(SalesGrowth, lag(1 2) model(fodev)) gmmiv(WPromoterSharesin1, lag(1 2) model(fodev)) overid
          Code:
          2-step weighting matrix from full model
          
                            | Excluding                   | Difference                  
          Moment conditions |       chi2     df         p |        chi2     df         p
          ------------------+-----------------------------+-----------------------------
            1, model(fodev) |   240.5146    201    0.0295 |     77.8898     46    0.0023
            2, model(fodev) |   145.6662     97    0.0010 |    172.7382    150    0.0986
            3, model(fodev) |   304.5946    245    0.0057 |     13.8098      2    0.0010
            4, model(fodev) |   314.3658    244    0.0016 |      4.0386      3    0.2573
            5, model(fodev) |   291.7540    220    0.0009 |     26.6504     27    0.4828
            6, model(fodev) |   292.7651    220    0.0007 |     25.6393     27    0.5387
            7, model(fodev) |   309.7668    246    0.0036 |      8.6376      1    0.0033
            8, model(level) |   293.4582    234    0.0050 |     24.9462     13    0.0235
          What potential options can I try to ensure the validity of instruments for my model as indicated by Sargan-Hansen test?

          Thanks!

          Comment


          • These results indicate that you are using way too many instruments. You need to substantially reduce this number to obtain reliable overidentification test results.
            https://www.kripfganz.de/stata/

            Comment


            • Ok, Prof. Kripfganz. So the count of instruments in #139 is 271. I now use the following command and the number of instruments drops to 38. Still, the difference-in-Hansen output does not change much as shown below.

              Code:
              xtdpdgmm Profitability4 L.Profitability4 Size2 AgeoftheFirm Leverage1 CurrentRatio SalesGro CapitalExpenditure2 WPromoterSharesin1 AD_Totalremuneration , teffects twostep vce(cluster CompanyID) gmmiv(L.Profitability4, lag(0 6) coll model(fodev)) iv(Leverage1, lag(0 1) model(fodev)) iv(CurrentRatio, lag(0 1) model(fodev)) iv(CapitalExpenditure2, lag(0 1) model(fodev)) iv(AD_Totalremuneration, lag(0 1) model(fodev)) iv(Size2 AgeoftheFirm SalesGrowth WPromoterSharesin1, lag(1 2) model(fodev)) nofootnote overid
              Code:
              2-step weighting matrix from full model
              
                                | Excluding                   | Difference                  
              Moment conditions |       chi2     df         p |        chi2     df         p
              ------------------+-----------------------------+-----------------------------
                1, model(fodev) |    38.6065      7    0.0000 |     32.5664      7    0.0000
                2, model(fodev) |    42.5449     12    0.0000 |     28.6280      2    0.0000
                3, model(fodev) |    55.3659     12    0.0000 |     15.8070      2    0.0004
                4, model(fodev) |    69.5016     12    0.0000 |      1.6712      2    0.4336
                5, model(fodev) |    69.0155     12    0.0000 |      2.1574      2    0.3400
                6, model(fodev) |    49.3091      6    0.0000 |     21.8638      8    0.0052
                7, model(level) |     1.7012      1    0.1921 |     69.4717     13    0.0000
              Below are my queries:

              1. I changed number of lags and used iv() instead of gmmiv() in order to bring down the number of instruments with the aim to satisfy difference-in-Hansen test (however, it did not work). Is this approach permissible? Or are there any other ways available to bring down the number of instruments?
              2. The overall Sargan-Hansen test is not getting satisfied despite trying a range of permutations and combinations. Does it indicate that the specification of the model is wrong?
              3. If the overall Sargan-Hansen gets satisfied and difference-in-Hansen appears like the one below, can we consider instrument validity to hold?

              Code:
              2-step weighting matrix from full model
              
                                | Excluding                   | Difference                  
              Moment conditions |       chi2     df         p |        chi2     df         p
              ------------------+-----------------------------+-----------------------------
                1, model(fodev) |   255.3239    250    0.3950 |     22.5685     10    0.0125
                2, model(fodev) |   221.3410    210    0.2823 |     56.5514     50    0.2437
                3, model(fodev) |   213.2575    210    0.4244 |     64.6349     50    0.0798
                4, model(fodev) |   226.4888    210    0.2070 |     51.4037     50    0.4185
                5, model(fodev) |   185.8645    155    0.0459 |     92.0280    105    0.8128
                6, model(level) |   277.5917    256    0.1691 |      0.3007      4    0.9898
                7, model(level) |   258.3016    246    0.2825 |     19.5908     14    0.1436
              Thanks!
              Last edited by Prateek Bedi; 17 Apr 2020, 13:51.

              Comment


              • 1. iv(Leverage1, lag(0 1) model(fodev)) is the same as gmm(Leverage1, collapse lag(0 1) model(fodev)), so yes.
                2. Technically, yes. At least some of the instruments are invalid. There can be many reasons for this and your results unfortunately do not provide any useful insights. It could be that some of the variables that you treated as predetermined are in fact endogenous, in which case you should start with the instruments at lag 1 instead of 0. It could also mean that there are omitted variables. These could be lags of the independent variables as further regressors, or other variables not included in the model at all.
                3. There would be some worries about the validity of the instruments in set 1 (and to a lesser degree in set 3), for which the Difference test rejects the null hypothesis. It is then up to you how much emphasis you want to put on these statistical results relative to theoretical justifications for your model specification.
                https://www.kripfganz.de/stata/

                Comment


                • A new update of the xtdpdgmm command to version 2.2.5 is available for installation from my website:
                  Code:
                  net install xtdpdgmm, from(http://www.kripfganz.de/stata/) replace
                  This version fixes a bug with the postestimation commands that led to unexpected error messages when the constant term was omitted due to collinearity.
                  https://www.kripfganz.de/stata/

                  Comment


                  • Originally posted by Sebastian Kripfganz View Post
                    1. iv(Leverage1, lag(0 1) model(fodev)) is the same as gmm(Leverage1, collapse lag(0 1) model(fodev)), so yes.
                    2. Technically, yes. At least some of the instruments are invalid. There can be many reasons for this and your results unfortunately do not provide any useful insights. It could be that some of the variables that you treated as predetermined are in fact endogenous, in which case you should start with the instruments at lag 1 instead of 0. It could also mean that there are omitted variables. These could be lags of the independent variables as further regressors, or other variables not included in the model at all.
                    3. There would be some worries about the validity of the instruments in set 1 (and to a lesser degree in set 3), for which the Difference test rejects the null hypothesis. It is then up to you how much emphasis you want to put on these statistical results relative to theoretical justifications for your model specification.
                    Alright, thanks Prof. Kripfganz for your quick reply.

                    1.What are your thoughts on validity of instruments in set 5 for which the 'Excluding' test is also significant with p-value 0.0459.
                    2. It seems very difficult to ensure that all difference-in-Hansen tests are satisfied for a given model. How much importance should we attach to these tests in order to finalise a model?

                    Comment


                    • 1. In this particular case, this could simply be an indication that the instruments in set 5 are essential for the model to be identified, i.e. once you exclude them the other instruments may no longer be strong enough for some of the regressors.
                      2. This very much depends on your target audience, if they let you get away with these results. If the model is reasonably specified and you can theoretically justify your assumptions, then I personally would not worry too much.
                      https://www.kripfganz.de/stata/

                      Comment


                      • Dear Sebastian,

                        last year in May you wrote that margins was not supported after xtdpdgmm at that time. Is it supported now?

                        Best,
                        Immanuel

                        Comment


                        • Ok, Prof. Kripfganz. So, as a rule of thumb, the null hypotheses regarding all sets of instruments in 'Excluding' column and 'Difference' column should be not get rejected i.e. the p-values should ideally be greater than 0.10, Am I right?

                          Comment


                          • Originally posted by Prateek Bedi View Post
                            So, as a rule of thumb, the null hypotheses regarding all sets of instruments in 'Excluding' column and 'Difference' column should be not get rejected i.e. the p-values should ideally be greater than 0.10, Am I right?
                            Ideally, yes. Kiviet (2020) even promotes the idea that the p-values should be much larger than 0.10 for practical purposes.
                            https://www.kripfganz.de/stata/

                            Comment


                            • Originally posted by Immanuel Feld View Post
                              Dear Sebastian,

                              last year in May you wrote that margins was not supported after xtdpdgmm at that time. Is it supported now?

                              Best,
                              Immanuel
                              Unfortunately, it is still not supported as I did not yet find the time to look into it. It is possible that the support for margins might be straightforward to implement but I want to make sure that I get it right. The xtdpdgmm project is already quite large such that I need to be extra careful with any changes to avoid unintended consequences.

                              Just for myself, I leave a bookmark to another useful thread on the margins support for community-contributed commands:
                              https://www.statalist.org/forums/for...ritten-command
                              https://www.kripfganz.de/stata/

                              Comment


                              • Immanuel Feld:

                                It seems that margins was already working as long as you added the force option when your model includes a lagged dependent variable.

                                With the new version 2.2.6 that is now available on my website, margins (and marginsplot) should work as expected without the force option.
                                Code:
                                net install xtdpdgmm, from(http://www.kripfganz.de/stata/) replace
                                Note however that in models with a lagged dependent variable, all marginal effects are calculated treating the lagged dependent variable as fixed. This is appropriate for so-called "short-run effects". For "long-run effects", use the nlcom command (but you need to enter the relevant formula by hand).

                                Disclaimer: I have not thoroughly checked that margins works correctly under all possible circumstances. Use at your own risk! If you find anything that does not seem right, please let me know.
                                https://www.kripfganz.de/stata/

                                Comment

                                Working...
                                X