Announcement

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

  • Sebastian Kripfganz
    replied
    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.

    Leave a comment:


  • Sarah Magd
    replied
    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

    Leave a comment:


  • Sebastian Kripfganz
    replied
    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.

    Leave a comment:


  • Sarah Magd
    replied
    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.

    Leave a comment:


  • Sebastian Kripfganz
    replied
    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.

    Leave a comment:


  • Giorgio Di Stefano
    replied
    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, 17:01.

    Leave a comment:


  • Giorgio Di Stefano
    replied
    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

    Leave a comment:


  • Sebastian Kripfganz
    replied
    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.

    Leave a comment:


  • Giorgio Di Stefano
    replied
    Hi @Sebastian,
    Does this command
    1. accept margins, factorial notations,

    2 has limits for T dimensions and

    3 can be adapted for estimation of quadratic equation?

    Do you think it will be suitable for my case here?
    https://www.statalist.org/forums/for...tegar-vs-other

    Leave a comment:


  • Sebastian Kripfganz
    replied
    An update for xtdpdgmm to version 2.3.10 is now available on my personal website:
    Code:
    net install xtdpdgmm, from(http://www.kripfganz.de/stata) replace
    This update adds the option nolevel with the following implications:
    • The option nolevel changes the default for the model() option to model(difference). Any gmm() and iv() instruments explicitly specified for model(level) will be ignored. (An intercept is still estimated for the level model unless option noconstant is specified as well.)
    • If time effects are added with option teffects, the option nolevel implies that they will be instrumented with standard instruments for the transformed model (as specified with option model()) instead of the level model. While time dummies are always valid instruments in the untransformed model, specifying them for the transformed model instead can still be useful to exactly replicate results from a "difference-GMM" estimator (in unbalanced panels).
    • In combination with option small, the option nolevel corrects the small-sample standard-error adjustment for the reduction of time periods in the transformed model or the absorbed group-specific effects.
    With the latter modification, xtdpdgmm can now replicate the standard errors of the fixed-effects estimator in a balanced panel:
    Code:
    webuse psidextract
    
    regress lwage wks i.id
    xtreg lwage wks, fe
    xtdpdgmm lwage wks, iv(wks) model(mdev) norescale small nolevel
    With robust standard errors, this applies only to the LSDV estimator implemented with regress:
    Code:
    regress lwage wks i.id, vce(cluster id)
    xtdpdgmm lwage wks, iv(wks) model(mdev) norescale small nolevel vce(robust)
    To replicate the xtreg results (besides the standard error for the constant), the new nolevel option must not be used due to an inconsistency in the way xtreg computes its standard errors:
    Code:
    xtreg lwage wks, fe vce(robust)
    xtdpdgmm lwage wks, iv(wks) model(mdev) norescale small vce(robust)
    For unbalanced panels, the equivalence breaks down due to slightly different ways in which the variance parameter is estimated.

    With the nolevel option, we can now also replicate the robust standard errors for a first-difference regression:
    Code:
    regress D.(lwage wks), nocons vce(cluster id)
    xtdpdgmm lwage wks, nocons iv(wks, difference) model(difference) small nolevel vce(robust)
    Without robust standard errors, the standard errors differ by a factor of sqrt(2) because regress ignores the first-order serial correlation in the first-differenced errors when estimating the variance parameter. For a similar reason, xtdpdgmm needs to be run with option wmatrix(separate) to replicate the results:
    Code:
    regress D.(lwage wks), nocons
    xtdpdgmm lwage wks, nocons iv(wks, difference) model(difference) wmatrix(separate) small nolevel
    As always, comments are welcome.

    Leave a comment:


  • Sebastian Kripfganz
    replied
    The two commands differ in the following way of how instruments are specified:

    Command 1:
    • Lags 2-4 of X2 X3 X5 are used for the first-differenced model, and their first-differenced lag 1 for the level model: This is consistent with treating those variables as endogenous.
    • Lags 1-3 of X1 X4 X6 are used for the first-differenced model, and their first-differenced lag 0 for the level model: This is consistent with treating those variables as predetermined.
    • The first-differenced lag 2 of Y (equivalently, lag 1 of L.Y) is used for the level model. This is not normally done. The usual approach would be to use the first-differenced lag 1 of Y (or lag 0 of L.Y), treating L.Y as predetermined, as in command 2.

    Command 2:
    • Lags 1-3 of X2 X3 X5 are used for the first-differenced model, and their first-differenced lag 0 for the level model: This is consistent with treating those variables as predetermined.
    • Lags 2-4 of X1 X4 X6 are used for the first-differenced model, and their first-differenced lag 1 for the level model: This is consistent with treating those variables as endogenous.
    As you can see, the two commands specify quite different models regarding the assumptions on the regressors. It is thus not surprising that the results differ. You need to classify your variables first into endogenous, predetermined, and possibly even strictly exogenous, and then specify the instruments accordingly. The lagged dependent variable L.Y should normally be treated as predetermined (equivalently, the dependent variable Y itself is endogenous).

    Leave a comment:


  • Sarah Magd
    replied
    Dear Prof. Kripfganz,
    Thanks a lot for the kind reply.
    I am estimating a Two-step sys-GMM model. The GMM variables are Y, X2, X3, and X5. The standard type instrumental variables are X1, X4, and X6. I am interested in measuring the effect of X1 on Y, while controlling for X2 - X6. If I follow slide 36 in your presentation, I will have the following code:
    xtdpdgmm L(0/1).Y X1 X2 X3 X4 X5 X6, model(diff) collapse gmm(Y X2 X3 X5, lag(2 4)) gmm(X1 X4 X6, lag(1 3)) gmm(L.Y X2 X3 X5, lag(1 1) diff model(level)) gmm(X1 X4 X6, lag (0 0) diff model (level)) two vce(r) overid


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

    Moment conditions: linear = 29 Obs per group: min = 12
    nonlinear = 0 avg = 12
    total = 29 max = 12

    (Std. Err. adjusted for 28 clusters in iso_num)
    ------------------------------------------------------------------------------
    | WC-Robust
    Y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    Y |
    L1. | .750354 .0993251 7.55 0.000 .5556804 .9450276
    |
    X1 | -.0971481 .026813 -3.62 0.000 -.1497006 -.0445957
    X2 | .1206079 .0417213 2.89 0.004 .0388356 .2023802
    X3 | -.0106342 .0094052 -1.13 0.258 -.029068 .0077996
    X4 | .1750596 .0703999 2.49 0.013 .0370783 .3130409
    X5 | -.0485218 .0645342 -0.75 0.452 -.1750065 .077963
    X6 | -.0862296 .0877262 -0.98 0.326 -.2581698 .0857107
    _cons | -2.368251 .7525372 -3.15 0.002 -3.843196 -.8933049
    ------------------------------------------------------------------------------

    ################################################## #########################################
    However, If I follow the code you have written in #367, I will write it as:
    xtdpdgmm L(0/1).Y X1 X2 X3 X4 X5 X6, gmm(L.Y X2 X3 X5, lag(1 3) model(diff)) gmm(X1 X4 X6, lag(2 4) model(diff)) gmm(L.Y X2 X3 X5, lag(0 0) model(level)) gmm(X1 X4 X6, lag(1 1) model(level)) collapse twostep vce(robust) overid
    Group variable: iso_num Number of obs = 336
    Time variable: year Number of groups = 28

    Moment conditions: linear = 29 Obs per group: min = 12
    nonlinear = 0 avg = 12
    total = 29 max = 12

    (Std. Err. adjusted for 28 clusters in iso_num)
    ------------------------------------------------------------------------------
    | WC-Robust
    Y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    Y |
    L1. | .9801545 .0080521 121.73 0.000 .9643727 .9959363
    |
    X1 | .0113918 .0145576 0.78 0.434 -.0171407 .0399242
    X2 | .0061909 .0067092 0.92 0.356 -.0069589 .0193408
    X3 | -.027684 .0097786 -2.83 0.005 -.0468496 -.0085184
    X4 | .0029569 .0073707 0.40 0.688 -.0114895 .0174032
    X5 | .0124367 .0095314 1.30 0.192 -.0062445 .0311179
    X6 | -.0314285 .0125523 -2.50 0.012 -.0560305 -.0068264
    _cons | -.1772037 .1035587 -1.71 0.087 -.3801751 .0257677
    ------------------------------------------------------------------------------
    ################################################## ############################################
    As you see, the two codes give different results for my variables of interest (i.e., X1).
    I am very confused. Would you please guide me on which command I should use?



    Last edited by Sarah Magd; 28 Feb 2022, 06:22.

    Leave a comment:


  • Sebastian Kripfganz
    replied
    Sarah Magd
    A rejection of the test outlined in my post #367 above does not provide conclusive evidence for cross-sectional dependence. If there is cross-sectional dependence, we would expect to reject the null hypothesis. However, rejecting the null hypothesis could be for many other reasons than cross-sectional dependence. In your case, the instruments gmm(Y, lag(1 3) model(diff)) are invalid by construction of the model. The first lag of Y cannot be a valid instrument for the first-differenced model because it is correlated with the first-differenced error term. You need to start with lag 2 (or lag 1 of L.Y). This misspecification would already explain the rejection of the test.

    Wycliff Ombuki
    You could use a difference-in-Hansen test to check for endogeneity against weak or strict exogeneity. In a very simplified model, let X be a regressor for which you are unsure whether it should be specified as endogenous or predetermined. You would then specify separately the additional instrument which is only valid under predeterminedness and check the difference-in-Hansen test for this instrument:
    Code:
    xtdpdgmm Y X, model(diff) gmm(X, lag(2 .)) gmm(X, lag(1 1)) twostep vce(robust) overid
    estat overid, difference
    In a next step, you could add gmm(X, lag(0 0)) to test weak versus strict exogeneity. See the section on Model Selection in my 2019 London Stata Conference presentation.

    Jerry Kim
    The serial correlation test is still applicable after estimating the model with the FOD transformation. The test is still carried out for the first-differenced residuals. It is still relevant because the FOD transformation only yields serially uncorrelated errors if the untransformed errors were serially uncorrelated as well (which we test by checking for absence of second- and higher-order serial correlation in first differences).

    Leave a comment:


  • Jerry Kim
    replied
    Dear Sebastian,

    Thanks for developing the xtdgdgmm package which is very helpful for researchers. I have a question regarding serial correlation test.

    Regarding the specification test of serial correlation, for example
    Code:
    estat serial, ar(1/3)
    presents the serial correlation test of first differenced error terms from one order lagged to three order lagged.

    However, if I use FOD transformation
    Code:
    model(fodev)
    can I still use
    Code:
    estat serial
    for the correlation test ? Or there is even no need for conducting serial correlation test for FOD-GMM models as in page 66/128 of your tutorial slides, FOD transformation yields serially uncorrelated errors in the FOD form.

    Thank you and look forward to hearing from you.

    Best
    Jerry

    Leave a comment:


  • Wycliff Ombuki
    replied
    Hello sebastian. How does one test for presence of endogeneity when using the xtdpdgmm command.

    Leave a comment:

Working...
X