Announcement

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

  • #76
    You already looked at all my usual recommendations. I am afraid I do not see anything obvious that could still be done here. With such a large sample size, the Arellano-Bond test might already pick up small deviations from the null hypothesis of no serial correlation. This could be due to any omitted variables. It then requires your judgement whether you worry much about such a small misspecification. If you can show that your results are robust to different specifications (e.g. different lag orders), and ideally the Hansen test does not reject the overidentifying restrictions, it might be okay to nevertheless accept this specification.

    An alternative might be to use higher-order starting lags, say lagrange(3 .) instead of lagrange(2 .) which would allow for second-order serial correlation in the first-differenced errors, although at the cost of using weaker instruments.
    https://twitter.com/Kripfganz

    Comment


    • #77
      Dear Sebastian,

      many thanks for the comments.

      I am going to address your alternative.

      Comment


      • #78
        Following up on a discussion I just had elsewhere, here is a word of caution on predictions after the xtseqreg two-stage estimation: The postestimation predict command by default only creates predictions based on the first-stage estimates. To generate predictions based on the full model, predictions need to be obtained for both stages separately (using the equation() suboption of predict) and then added up:

        Code:
        webuse psidextract
        xtseqreg lwage (wks south smsa ms exp exp2 occ ind union) fem blk ed, both
        predict yhat1, xb equation(_first)
        predict yhat2, xb equation(_second)
        gen yhat = yhat1 + yhat2
        https://twitter.com/Kripfganz

        Comment


        • #79
          I have fixed a minor bug in xtseqreg that could result in an incorrect error message in rare instances when using option vce(cluster) on a subsample of the data. The new version 1.2.4 is available on my website:
          Code:
          net install xtseqreg, from(http://www.kripfganz.de/stata/) replace
          https://twitter.com/Kripfganz

          Comment


          • #80
            Dear Prof. Kripfganz

            Thanks for developing the xtseqreg command! I have a question regarding the storage of first stage's results. Can I utilize
            Code:
            eststo md_st1
            to store the first stage estimation results (using
            Code:
            xtdpdgmm
            ) and then set
            Code:
            md_st1
            as

            Code:
            first(md_st1,copy)
            in the
            Code:
            first(,)
            argument of the second stage's estimation?

            Comment


            • #81
              You need to add the option auxiliary to your xtdpdgmm estimation. Then it should work.
              Code:
              xtdpdgmm ..., auxiliary ...
              eststo md_st1
              xtseqreg ..., first(md_st1, copy) ...
              https://twitter.com/Kripfganz

              Comment


              • #82
                Dear Sebastian,

                Thanks for the reply. However I encountered the error as follows:
                Code:
                option first() incorrectly specified
                r(322);
                My first stage code is:
                Code:
                eststo md_gmm_s1: xtdpdgmm s_it s_itlag1 eta_it elective ///
                    afterchangeseq beforecancel age, collapse model(diff) ///
                    gmm(s_itlag1, lag(1 2)) gmm(eta_it, lag(2 3)) ///
                    gmm(elective sftlen beforecancel afterchangeseq age, lag(0 1)) ///
                    nocons two vce(clu surgeon2) auxiliary
                and the output in stata is like this:

                Code:
                Generalized method of moments estimation
                
                Fitting full model:
                Step 1         f(b) =  5.2919369
                Step 2         f(b) =   .0051382
                
                Group variable: sftidx                       Number of obs         =      8961
                Time variable: newseq                        Number of groups      =      2055
                
                Moment conditions:     linear =      13      Obs per group:    min =         2
                nonlinear =       0                        avg =  4.360584
                total =      13                        max =         9
                
                
                s_it       Coef.   Std. Err.      z    P>z     [95% Conf. Interval]
                
                /s_itlag1    .9226237   .1198261     7.70   0.000     .6877688    1.157479
                /eta_it    .8967318   .1621367     5.53   0.000     .5789497    1.214514
                /elective   -.8163833   3.944977    -0.21   0.836    -8.548397     6.91563
                /afterchange~q   -.1239053   2.830054    -0.04   0.965    -5.670709    5.422898
                /beforecancel    3.123461   4.865123     0.64   0.521    -6.412005    12.65893
                /age    .3229168   .1191281     2.71   0.007     .0894301    .5564035
                
                Instruments corresponding to the linear moment conditions:
                1, model(diff):
                L1.s_itlag1 L2.s_itlag1
                2, model(diff):
                L2.eta_it L3.eta_it
                3, model(diff):
                elective L1.elective sftlen beforecancel L1.beforecancel afterchangeseq
                L1.afterchangeseq age L1.age
                My second stage code is:
                Code:
                xtseqreg s_it (s_itlag1 eta_it elective afterchangeseq beforecancel ///
                    age ) sftlen surgnum, first(md_gmm_s1, copy) ///
                    iv(sftlen surgnum) vce(clu surgeon2) nocons
                where the two variables
                Code:
                sftlen surgnum
                are two time-invariant variables.

                Could you please let me know the potential errors in my code? Thank you!
                Last edited by Jerry Kim; 05 Oct 2021, 18:04.

                Comment


                • #83
                  The problem is with the nocons option. Since the first stage does not contain a constant, you need to specify first(md_gmm_s1, copy nocons). You then probably want to include a constant in your second stage, so do not specify nocons at the end of the command line, i.e.
                  Code:
                  xtseqreg s_it (s_itlag1 eta_it elective afterchangeseq beforecancel ///
                      age) sftlen surgnum, first(md_gmm_s1, copy nocons) ///
                      iv(sftlen surgnum) vce(clu surgeon2)
                  https://twitter.com/Kripfganz

                  Comment


                  • #84
                    Dear Sebastian,

                    Thanks for the suggesion! I reivsed the code however this time there is another error as follow:

                    Code:
                    not sorted
                    r(5);
                    Is it because the data not sorted by certain sequence?

                    Comment


                    • #85
                      Please check whether you have the latest version of both packages:
                      Code:
                      which xtdpdgmm
                      which xtseqreg
                      These should be 2.3.9 for xtdpdgmm and 1.2.4 for xtseqreg. If necessary, please update the commands:
                      Code:
                      net install xtdpdgmm, from(http://www.kripfganz.de/stata/) replace
                      net install xtseqreg, from(http://www.kripfganz.de/stata/) replace
                      If the problem persists with the latest versions, I am afraid I would need to see the actual data you used to replicate the problem. If you are able to share the data, please can you send it to me by e-mail?
                      https://twitter.com/Kripfganz

                      Comment


                      • #86
                        Dear Sebastian,

                        The versions are all up-to-date as you indicated.

                        However, I read again your slides about
                        Code:
                        xtdpdgmm
                        package in 2019 conference (the longer and more detailed one) and on page 86 "Estimation with time-invariant regressors in Stata". It shows the estimation with exogenous industry dummy (quote as follows):

                        Code:
                        xtdpdgmm L(0/1).n w k i.ind, model(diff) collapse gmm(n, lag(2 4)) gmm(w k, lag(1 3)) ///
                        > iv(i.ind, model(level)) nl(noserial) teffects igmm vce(r)
                        (Some output omitted)
                        Instruments corresponding to the linear moment conditions:
                        1, model(diff):
                        L2.n L3.n L4.n
                        2, model(diff):
                        L1.w L2.w L3.w L1.k L2.k L3.k
                        3, model(level):
                        2bn.ind 3.ind 4.ind 5.ind 6.ind 7.ind 8.ind 9.ind
                        4, model(level):
                        1978bn.year 1979.year 1980.year 1981.year 1982.year 1983.year 1984.year
                        5, model(level):
                        _cons
                        I am now trying to use the following code and everything seems right now.

                        Code:
                        eststo md_diffgmm_sl2: ///
                            qui xtdpdgmm s_it s_itlag1 eta_it elective ///
                            afterchangeseq beforecancel age i.prcdr2 i.bin2hr ///
                            sftlen, collapse model(diff) ///
                            gmm(s_itlag1, lag(1 2)) gmm(eta_it, lag(2 3)) ///
                            gmm(elective beforecancel afterchangeseq age i.prcdr2 i.bin2hr, lag(0 1)) ///
                            iv(sftlen, model(level)) nocons two vce(clu surgeon2)
                        Is this way okay for estimation of time-invariant variables coefficients by just using
                        Code:
                        xtdpdgmm
                        ?
                        Thank you!

                        Comment


                        • #87
                          In your case, where all instruments for the time-varying regressors are specified for the first-differenced model, and the coefficients of the time-invariant regressors are just-identified (i.e. there are as many instruments as time-invariant regressors), the two-stage approach with xtseqreg is not needed. The presence of the time-invariant regressors in this case does not affect the estimates of the coefficients for the time-varying regressors, and a second-stage regression would not yield any improvement. This is discussed in more technical terms in Appendix C.4 of the Supplementary Appendix for our JAE article: So, yes, your approach is absolutely fine. Just keep in mind that your identifying assumption for the coefficients of the time-invariant regressors is that those are uncorrelated with the unobserved individual/group-specific effects.
                          https://twitter.com/Kripfganz

                          Comment


                          • #88
                            Dear Sebastian,

                            Thanks a lot ! However if the time invariant regressor maybe correlated with the unobserved effect alpha_i, can I still use this method although with a different IV that is uncorrelated with alpha_i ? The code then should be as follows where third_party_IV is a different IV for sftlen, the time-invariant regressor.

                            Code:
                            eststo md_diffgmm_sl2, title("Estimator: FD-GMM including shift length"): ///
                                qui xtdpdgmm s_it s_itlag1 eta_it elective ///
                                afterchangeseq beforecancel age i.prcdr2 i.bin2hr ///
                                sftlen, collapse model(diff) ///
                                gmm(s_itlag1, lag(1 2)) gmm(eta_it, lag(2 3)) ///
                                gmm(elective beforecancel afterchangeseq age i.prcdr2 i.bin2hr, lag(0 1)) ///
                                iv(third_party_IV, model(level)) nocons two vce(clu surgeon2)
                            Last edited by Jerry Kim; 09 Oct 2021, 17:52.

                            Comment


                            • #89
                              Yes, that is absolutely fine.
                              https://twitter.com/Kripfganz

                              Comment


                              • #90
                                Hi Sebastian,
                                I wanted to ask if xtseqreg can be used for large N and large T panels.
                                Regards,
                                Debajyoti

                                Comment

                                Working...
                                X