Announcement

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

    1. Yes, xtdpdgmm accepts factor variable notation and the margins command can be used.
    2. The normal usage of the command is for settings with N>>T. If T is large relative to N, you need to make sure to limit the number of instruments by collapsing GMM-type instruments and curtailing the lag limit for the instruments. Otherwise, you would be running into a too-many-instruments problem with different kinds of adverse effects. A small N often leads to problems with estimating the optimal weighting matrix.
    3. You can add interactions and squares of the regressors, if this is what you have in mind.
    https://twitter.com/Kripfganz

    Comment


    • Originally posted by Sebastian Kripfganz View Post
      1. Yes, xtdpdgmm accepts factor variable notation and the margins command can be used.
      2. The normal usage of the command is for settings with N>>T. If T is large relative to N, you need to make sure to limit the number of instruments by collapsing GMM-type instruments and curtailing the lag limit for the instruments. Otherwise, you would be running into a too-many-instruments problem with different kinds of adverse effects. A small N often leads to problems with estimating the optimal weighting matrix.
      3. You can add interactions and squares of the regressors, if this is what you have in mind.
      Thanks Sebastian!
      Would you please kindly like to comment if your method is appropriate for my model here?
      https://www.statalist.org/forums/for...tegar-vs-other

      Comment


      • I asked you in another thread if your way is adopted for my case. Thanks for the reply there.!
        My N is around 50 and I alter according to the the groups. My T is large, T=80 and is reduced to 10 and when I estimate sub-periods, defined by decades. I have a large number of variables, a bunch of dummies and categorical variables.

        I am estimating a quadratic equation. My code when I estimate fixed effects for the entire period, T=80, is

        Code:
        xtreg growthgdp l.gdp cpi u Output dummy1dummy3 dummy3 categorical 1 categorical 2 c.indicator1##c.indicator1, vce(clustering panelid) fe
        Where indicator1 is a custom indicator I created,in percentage.
        I can think only of one lag in my model,already there.

        What will be the code to run in order estimate my model according to your xtdpgmm?

        My model is given in #1 in the link below here, where you can see the full maths formula.

        https://www.statalist.org/forums/for...tegar-vs-other

        Also, would my results change significantly if I change from xtreg in the full period of time, T=80, to your method for smaller ones, T=10? I understand that time is important but in terms of interpretation how will that effect?

        Thank you much for your help Sebastian Kripfganz
        Last edited by Giorgio Di Stefano; 28 Mar 2022, 18:01.

        Comment


        • As a starting point, you can replicate your xtreg results with xtdpdgmm as follows:
          Code:
          xtdpdgmm growthgdp l.gdp cpi u Output dummy1dummy3 dummy3 categorical 1 categorical 2 c.indicator1##c.indicator1, iv(l.gdp cpi u Output dummy1dummy3 dummy3 categorical 1 categorical 2 c.indicator1##c.indicator1) model(mdev) vce(clustering panelid) small
          From there, you can adjust the instruments as needed. This depends on your classification of the variables as exogenous, predetermined, or endogenous, as discussed in my 2019 London Stata Conference presentation.

          Whether your results will change significantly when you reduce the time horizon is an empirical issue.
          https://twitter.com/Kripfganz

          Comment


          • Dear Prof. Kripfganz,
            I am using the following command to run my Two-step GMM model:

            xtdpdgmm L(0/1).Y X1 X2 X3 X4 X5 X6 , model(diff) collapse gmm(l2.Y X1 X2 X3, lag(2 3)) gmm( X4 X5 X6, lag(1 2)) gmm( Y X1 X2 X3, lag(1 1) diff model(level)) gmm( X4 X5 X6 , lag(0 0) diff model (level)) two vce(r) overid noconstant teffects

            For brevity, I have removed the table of estimated coefficients. I have a problem with the diagnositc checks of the model. Speicifically, AR(1) and the 2-step moment functions, 3-step weighting matrix.

            . estat serial, ar(1/3)

            Arellano-Bond test for autocorrelation of the first-differenced residuals
            H0: no autocorrelation of order 1: z = -1.4381 Prob > |z| = 0.1504
            H0: no autocorrelation of order 2: z = 1.2272 Prob > |z| = 0.2197
            H0: no autocorrelation of order 3: z = -1.1119 Prob > |z| = 0.2662

            . estat overid

            Sargan-Hansen test of the overidentifying restrictions
            H0: overidentifying restrictions are valid

            2-step moment functions, 2-step weighting matrix chi2(14) = 6.7311 Prob > chi2 = 0.9446

            2-step moment functions, 3-step weighting matrix chi2(14) = 28.0000 Prob > chi2 = 0.0142
            ################################################## ##############################################

            Here are the number of groups in my model and the number of moment conditions:
            Group variable: id Number of obs = 332
            Time variable: year Number of groups = 28

            Moment conditions: linear = 33 Obs per group: min = 10
            nonlinear = 0 avg = 11.85714
            total = 33 max = 12

            (Std. Err. adjusted for 28 clusters in id)
            ################################################## ################################################## #
            My two questions are:
            - how can I solve the problem that AR(1) is insiginficant. I have tried many specifications but unfortunately they do not produce significant AR(1).
            - is it wrong that the number of instruments are 33 and the number of groups is 28? or should I only rely on the Hausman test for overidenifitication?

            I am looking forward to your guidance.

            Comment


            • All of these tests rely on asymptotics, where the number of groups is becoming large. 28 groups is almost certainly too small to expect reliable test results. The substantial differences between the two version of the Hansen test are also most likely a consequence of the small number of groups, which results in a poorly estimated weighting matrix. In a nutshell, the only way to really solve these problems is to increase the sample size. If that is not possible, then the GMM approach may not be applicable.
              https://twitter.com/Kripfganz

              Comment


              • Dear Prof. Kripfganz,
                Thanks for your reply.
                If AR(1) and AR(2) are significant, whereas AR(3) is insignificant. Can I show this result in my paper? or do I have to get AR(2) insignificant?
                H0: no autocorrelation of order 1: z = -4.1742 Prob > |z| = 0.0000
                H0: no autocorrelation of order 2: z = 2.1108 Prob > |z| = 0.0348
                H0: no autocorrelation of order 3: z = .80652 Prob > |z| = 0.4199

                Comment


                • A significant AR(2) test indicates first-order serial correlation in the level errors. This would imply that the lagged dependent variable is no longer predetermined but endogenous; and similarly for other predetermined variables in the model. As a consequence, the instruments normally used would no longer be valid. One approach would be to amend the model in an attempt to purge the remaining serial correlation. Another attempt would be to use deeper lags as instruments, e.g. lag(2 3) instead of lag(1 2) for predetermined and lag(3 4) instead of lag(2 3) for endogenous variables in the first-differenced model. Similarly, the lags need to be shifted by one period for the level model as well.
                  https://twitter.com/Kripfganz

                  Comment


                  • Dear Prof. Kripfganz,
                    Thanks a lot for your reply.
                    I have tried what you have recommended. The results of the tests became:

                    . estat serial, ar(1/3)

                    Arellano-Bond test for autocorrelation of the first-differenced residuals
                    H0: no autocorrelation of order 1: z = -1.4629 Prob > |z| = 0.1435
                    H0: no autocorrelation of order 2: z = 1.2267 Prob > |z| = 0.2199
                    H0: no autocorrelation of order 3: z = -1.1418 Prob > |z| = 0.2535

                    . estat overid

                    Sargan-Hansen test of the overidentifying restrictions
                    H0: overidentifying restrictions are valid

                    2-step moment functions, 2-step weighting matrix chi2(46) = 6.7936 Prob > chi2 = 1.0000

                    2-step moment functions, 3-step weighting matrix chi2(46) = 28.0000 Prob > chi2 = 0.9833

                    ################################################## #########################
                    Now, the problem is that AR(1) is insignificant. what would you suggest in this case?

                    Comment


                    • I am afraid there is not much I can say. You seem to have a challenging data set.
                      https://twitter.com/Kripfganz

                      Comment


                      • Dear Prof. Kripfganz,

                        Can we use xtdpdgmm or xtabond2 to estimate a dynamic panel threshold model?

                        Comment


                        • Originally posted by Sarah Magd View Post
                          Can we use xtdpdgmm or xtabond2 to estimate a dynamic panel threshold model?
                          If the threshold is known, you can simply incorporate interaction terms of your variables of interest with a threshold indicator variable into your model. This would then still be estimable with these commands. You cannot use these commands to estimate an unknown threshold.
                          https://twitter.com/Kripfganz

                          Comment


                          • Dear Prof. Kripfganz,
                            As you mentioned, my sample has only 28 groups which is relatively small and 11 years. Now, I am not sure whether I should control for the time-fixed effects or not.
                            Could you please guide me on this issue?

                            If I control for the time fixed effects (with the "teffects" option):
                            Group variable: iso_num Number of obs = 332
                            Time variable: year Number of groups = 28

                            Moment conditions: linear = 36
                            nonlinear = 0
                            total = 36

                            . estat overid

                            Sargan-Hansen test of the overidentifying restrictions
                            H0: overidentifying restrictions are valid
                            2-step moment functions, 2-step weighting matrix chi2(17) = 9.4441 Prob > chi2 = 0.9253
                            2-step moment functions, 3-step weighting matrix chi2(17) = 28.0000 Prob > chi2 = 0.0449

                            . estat serial, ar(1/3)

                            Arellano-Bond test for autocorrelation of the first-differenced residuals
                            H0: no autocorrelation of order 1: z = -3.7625 Prob > |z| = 0.0002
                            H0: no autocorrelation of order 2: z = -0.3943 Prob > |z| = 0.6934
                            H0: no autocorrelation of order 3: z = 1.2813 Prob > |z| = 0.2001
                            ################################################## ################################################## ##############

                            If I do not control for the time fixed effects:

                            Group variable: iso_num Number of obs = 332
                            Time variable: year Number of groups = 28

                            Moment conditions: linear = 28
                            nonlinear = 0
                            total = 28


                            . estat serial, ar(1/3)

                            Arellano-Bond test for autocorrelation of the first-differenced residuals
                            H0: no autocorrelation of order 1: z = -3.9181 Prob > |z| = 0.0001
                            H0: no autocorrelation of order 2: z = 1.7074 Prob > |z| = 0.0877
                            H0: no autocorrelation of order 3: z = 1.0675 Prob > |z| = 0.2858

                            . estat overid

                            Sargan-Hansen test of the overidentifying restrictions
                            H0: overidentifying restrictions are valid
                            2-step moment functions, 2-step weighting matrix chi2(21) = 26.0563 Prob > chi2 = 0.2043
                            2-step moment functions, 3-step weighting matrix chi2(21) = 28.0000 Prob > chi2 = 0.1402
                            Last edited by Sarah Magd; 01 Apr 2022, 09:20.

                            Comment


                            • The test results do not provide much guidance regarding the matter of time effects. In general, time effects are typically recommended to capture some shocks that effect all groups equally. In the model with time effects, you could check whether the coefficients of the time dummies are jointly statistically significant. If they are not, you could possible remove them.
                              https://twitter.com/Kripfganz

                              Comment


                              • Dear Sebastian,

                                I just found this problem recently. When I run the code below, xtdpdgmm produces the following error. While the second approach runs smoothly.

                                Code:
                                xtset id time
                                global var ="grev i.sector"
                                xtdpdgmm L(0/1).gempf $var, coll model(diff) gmm(gempf, lag(2 5)) gmm(grev, lag(2 5)) iv(i.sector, model(level)) two overid vce(robust) small teffect
                                Error:


                                Second approach (replacing teffect with quarter manually)
                                Code:
                                xtset id time
                                global var ="grev i.sector q12019-q32021"
                                xtdpdgmm L(0/1).gempf $var, coll model(diff) gmm(gempf, lag(2 5)) gmm(grev, lag(2 5)) iv(i.sector q12019-q32021, model(level)) two overid vce(robust) small
                                [/CODE]
                                Last edited by Tiyo Ardiyono; 18 Apr 2022, 00:50.

                                Comment

                                Working...
                                X