Announcement

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

  • #16
    Dear LP-DID authors,

    I keep getting the error message: "class FixedEffects undefined"

    What is going wrong here?

    PS: I am using your example data "http://fmwww.bc.edu/repec/bocode/l/lpdidtestdata1.dta" and example code "lpdid Y, unit(unit) time(time) treat(treat) pre_window(5) post_window(10)" from the help file.

    Comment


    • #17
      I fixed it: "reghdfe, compile" did the trick

      Comment


      • #18
        Hi,

        I am using LP-DiD package and want to check if there is a way one can change the level of the confidence interval. I did not come across any such option in the help file.

        Thanks

        Comment


        • #19
          the following is a quote from the help file:
          level(#) Significance level for confidence intervals, default is 95.
          this seems to clearly say that you are allowed to change the level

          Comment


          • #20
            Originally posted by Rich Goldstein View Post
            the following is a quote from the help file:

            this seems to clearly say that you are allowed to change the level
            Thank you. I missed it.

            Comment


            • #21
              Hi, I have a clarification question.

              Does the LP-DiD work for the sample with all treated units (staggered adoption) i.e., no never treated units? In such a case, pi = Infinity will never be the case.

              If yes, what would be the 'clean controls' for the unit with the last adoption in the sample?

              Thank you

              Comment


              • #22
                Bonjour à tous,
                Je suis un adepte des projections locales LPDID. Je l’ai utilisé pour estimer les effets de l’inflation sur le capital humain en Afrique subsaharienne. J’ai obtenu quelques résultats, mais je ne sais pas comment interpréter le graphique correspondant. De même, Stata a renvoyé le message suivant : attention : vos données ne sont pas fortement équilibrées. Veuillez évaluer s’il s’agit d’un problème dans votre application ou non. Cependant, j’ai précédemment traité les variables manquantes.
                J’ai utilisé le code :
                lpdid prévalence de la sous-alimentation, unité (pays) temps(années) traiter (INFLA) pre_window(5) post_window(10)

                La variable INFLA est celle qui prend la valeur 1 lorsque l’inflation > 5 et 0 dans le cas contraire.

                Cependant, j’aimerais estimer les effets dynamiques et hétérogènes et je demande de l’aide.

                Comment


                • #23
                  Originally posted by Shifu Jiang View Post
                  Dear Alexander/Daniele,

                  Could you please suggest if I need to address the Nickell bias in LP-DID?
                  If yes, does the ANRR exercise in the paper use an Arellano-Bond estimator, and is this implemented by the package?
                  Many thanks in advance!
                  Hi Shifu,

                  Thanks for your interest and for the question!

                  Nickell bias can arise if you include the lagged outcome as a control variable. In that case, bias can be created by the presence of y_{i,t–1} both as a regressor and in the error term (which is equal to e_{i,t+k} – e_{i,t–1}). We know that Nickell bias tends to be negligible if you have many time periods or if autocorrelation is not strong. The ANRR application features many time periods, so Nickell bias is unlikely to be a problem there. But Nickell bias can be an issue if the time dimension is limited and at the same time autocorrelation is strong. In that case one can use a split sample correction to eliminate the bias (as done for example here https://www.aeaweb.org/articles?id=1...pandp.20191071 or here https://arxiv.org/pdf/2302.13455 ). The lpdid command does not feature an option for implementing the split sample correction, so you would have to do that part yourself (it's not hard).

                  I hope this helps!

                  Comment


                  • #24
                    Originally posted by Swati Singh View Post
                    Hi, I have a clarification question.

                    Does the LP-DiD work for the sample with all treated units (staggered adoption) i.e., no never treated units? In such a case, pi = Infinity will never be the case.

                    If yes, what would be the 'clean controls' for the unit with the last adoption in the sample?

                    Thank you
                    Hi Swati,
                    Thanks for your interest and for the question!

                    The baseline version of LP-DiD uses not yet treated units as controls for newly treated units. For a treatment event happening at time t=p, units that are still untreated at time t=p+h constitute the 'clean' control group. This should make it clear that the LP-DiD estimator does not necessarily require the presence of a never treated group. Of course, without any never treated units, you are not going to be able to let the effect of the last treatment event contribute to the average estimate, because there are just no suitable control units for that treatment event (no units are still untreated at the time of that last event).

                    Two relevant caveats about this:

                    (1) If you use the 'nevertreated' option of the lpdid command, which requires using only never treated observations as control units, then of course the estimator with this option will not work unless there is a never treated group in the data

                    (2) By using the nonabsorbing(L) option in the lpdid command, where L is an integer, you add the assumption that treatment effects stabilise after L periods. In that case, you can estimate the effect of the last treatment event even in the case you are describing (where there are no not-yet-treated controls for that last treatment event), because units which entered treatment more than L periods before the last treatment event can be used as controls.

                    Hope this helps!

                    Comment


                    • #25
                      Originally posted by Atebs Attecho View Post
                      Bonjour à tous,
                      Je suis un adepte des projections locales LPDID. Je l’ai utilisé pour estimer les effets de l’inflation sur le capital humain en Afrique subsaharienne. J’ai obtenu quelques résultats, mais je ne sais pas comment interpréter le graphique correspondant. De même, Stata a renvoyé le message suivant : attention : vos données ne sont pas fortement équilibrées. Veuillez évaluer s’il s’agit d’un problème dans votre application ou non. Cependant, j’ai précédemment traité les variables manquantes.
                      J’ai utilisé le code :
                      lpdid prévalence de la sous-alimentation, unité (pays) temps(années) traiter (INFLA) pre_window(5) post_window(10)

                      La variable INFLA est celle qui prend la valeur 1 lorsque l’inflation > 5 et 0 dans le cas contraire.

                      Cependant, j’aimerais estimer les effets dynamiques et hétérogènes et je demande de l’aide.
                      Hi Atebs

                      Thanks for your interest and for the question!

                      I can't really understand French, but I hope the automatic translation did a good job. The message you got is just giving you a 'heads up' that your panel is not balanced. It's up to you to assess whether it's a problem in your setting or not. It's not necessarily an issue, especially if you don't use the 'pmd' option of lpdid. However, I note that your setting seems one of non-absorbing treatment: countries enter and exit periods of high inflation. So you probably need to use the nonabsorbing() option, as described in the help file. More generally, I would suggest thinking whether a difference-in-differences design is appropriate in this setting and why. It seems likely that countries that cross the 5% inflation threshold were already on different underlying trends relative to countries with stable inflation, I would say. But you know your setting well and I don't, so this is just a thought based on your description.

                      I hope this helps - Good luck with your project!

                      Comment


                      • #26
                        Hi Daniele,

                        Thanks a lot for the LPDID, it works really great. Somehow, I want to do some non-binary treatments. It is actually an intercept term of a binary and a non-binary. Can you guide me in the direction, or if it is feasible? From your message in STATA, it seems that the non-binary treatment is possible.

                        Thanks a lot for your great contribution!
                        Tom

                        Comment


                        • #27
                          Dear authors,
                          Thanks much for this package.

                          I'm using Stata 14 and like the colleague above I had to edit the entire chunk of the ado file that uses spbalance. After that the package started working.

                          I've been trying to re-run some models I had estimated using csdid2 before, under conditional parallel trends. I can't understand, however, if the control command is conditioning parallel trends or acting as a "regular control".

                          Conditional parallel trends are mentioned in the package description but nos specifically discussed in the parameters.

                          Any guidance here would be greatly appreciated!

                          With best regards,
                          Bruno

                          Comment


                          • #28
                            Originally posted by Bruno pantaleao View Post
                            Dear authors,
                            Thanks much for this package.

                            I'm using Stata 14 and like the colleague above I had to edit the entire chunk of the ado file that uses spbalance. After that the package started working.

                            I've been trying to re-run some models I had estimated using csdid2 before, under conditional parallel trends. I can't understand, however, if the control command is conditioning parallel trends or acting as a "regular control".

                            Conditional parallel trends are mentioned in the package description but nos specifically discussed in the parameters.

                            Any guidance here would be greatly appreciated!

                            With best regards,
                            Bruno
                            hi Bruno

                            You are right about spbalance - it does create an incompatibility with versions of STATA previous to 15. Apologies, it’s a bug we should fix to make the command fully compatible with stata 14.

                            About covariates: When you use the controls() option in combination with the rw option, it estimates the regression adjustment LP-DiD specification with covariates described in Section 4.1.1 of the paper (http://doi.org/10.1002/jae.70000). If you use controls() without the rw option, it will add covariates directly in the (non-reweighted) LP-DiD specification, which (unless the specification is fully saturated) relies on additional assumptions as described in section 4.1.2 in the paper. In both cases you are making a conditional parallel trends assumption.

                            i hope this helps!

                            Daniele





                            Comment


                            • #29
                              Thanks so much, Daniele

                              I did try the rw solution, but it does not estimate at all. All coefs are estimated as points when I add the rw command accompanied by any controls.
                              The rw commanda does work without controls.
                              I'm afraid it is related to the Stata version!

                              Code:
                              lpdid tx_furto , unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) controls(bscontrol) rw  
                              lpdid tx_furto, unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) rw controls(bscontrol)
                              Your specification requires estimation through regression adjustment, which in the current version of the program uses a lot of computational power and hence may take
                              > a while. We are sorry and will update this in a new version to deliver a faster option soon!
                              
                              LP-DiD Event Study Estimates
                              
                                    E-time | Coeffic~t         SE          t      P>|t|  [95% co~.  interval]        obs
                              -------------+-----------------------------------------------------------------------------
                                      pre4 |         .          .          .          .          .          .          .
                                      pre3 |         .          .          .          .          .          .          .
                                      pre2 |         .          .          .          .          .          .          .
                                      pre1 |         0          .          .          .          .          .          .
                                      tau0 |         .          .          .          .          .          .          .
                                      tau1 |         .          .          .          .          .          .          .
                                      tau2 |         .          .          .          .          .          .          .
                                      tau3 |         .          .          .          .          .          .          .
                                      tau4 |         .          .          .          .          .          .          .
                              
                              LP-DiD Pooled Estimates
                              
                                           | Coeffic~t         SE          t      P>|t|  [95% co~.  interval]        obs
                              -------------+-----------------------------------------------------------------------------
                                       Pre |         .          .          .          .          .          .          .
                                      Post |         .          .          .          .          .          .          .

                              Then, I tried to remove the rw option and add the baseline controls as I would in an OLS.
                              It took about 8 minutes to run with a sample of 1000 units and 28 periods using 16gb of RAM an an I7 processor, but the standard errors were not estimated.

                              Code:
                              . lpdid tx_furto , unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) controls(c.bscontro#i.id)   nevertreated
                              lpdid tx_furto, unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) nevertreated controls(c.bscontro#i.id)
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              Warning:  variance matrix is nonsymmetric or highly singular
                              
                              LP-DiD Event Study Estimates
                              
                                    E-time | Coeffic~t         SE          t      P>|t|  [95% co~.  interval]        obs 
                              -------------+-----------------------------------------------------------------------------
                                      pre4 |  253.6607          0          .          .   253.6607   253.6607      21023 
                                      pre3 |  70.52995          0          .          .   70.52995   70.52995      21933 
                                      pre2 |  191.1218          0          .          .   191.1218   191.1218      22843 
                                      pre1 |         0          .          .          .          .          .          . 
                                      tau0 | -42.97887          0          .          .  -42.97887  -42.97887      23753 
                                      tau1 |  222.0593          0          .          .   222.0593   222.0593      22843 
                                      tau2 |  162.7009          0          .          .   162.7009   162.7009      21933 
                                      tau3 |  392.0703          0          .          .   392.0703   392.0703      21023 
                                      tau4 |   536.738          0          .          .    536.738    536.738      20113 
                              
                              LP-DiD Pooled Estimates
                              
                                           | Coeffic~t         SE          t      P>|t|  [95% co~.  interval]        obs 
                              -------------+-----------------------------------------------------------------------------
                                       Pre |   171.775          0          .          .    171.775    171.775      21023 
                                      Post |  251.6097          0          .          .   251.6097   251.6097      20113 
                              
                              . 
                              end of do-file


                              Anyway, thanks for the response and the explanation!
                              Very useful package! Will eagerly wait for the new versions.

                              With best regards,
                              Last edited by Bruno pantaleao; 21 Jul 2025, 07:21.

                              Comment


                              • #30
                                Originally posted by Bruno pantaleao View Post
                                Thanks so much, Daniele

                                I did try the rw solution, but it does not estimate at all. All coefs are estimated as points when I add the rw command accompanied by any controls.
                                The rw commanda does work without controls.
                                I'm afraid it is related to the Stata version!

                                Code:
                                lpdid tx_furto , unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) controls(bscontrol) rw
                                lpdid tx_furto, unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) rw controls(bscontrol)
                                Your specification requires estimation through regression adjustment, which in the current version of the program uses a lot of computational power and hence may take
                                > a while. We are sorry and will update this in a new version to deliver a faster option soon!
                                
                                LP-DiD Event Study Estimates
                                
                                E-time | Coeffic~t SE t P>|t| [95% co~. interval] obs
                                -------------+-----------------------------------------------------------------------------
                                pre4 | . . . . . . .
                                pre3 | . . . . . . .
                                pre2 | . . . . . . .
                                pre1 | 0 . . . . . .
                                tau0 | . . . . . . .
                                tau1 | . . . . . . .
                                tau2 | . . . . . . .
                                tau3 | . . . . . . .
                                tau4 | . . . . . . .
                                
                                LP-DiD Pooled Estimates
                                
                                | Coeffic~t SE t P>|t| [95% co~. interval] obs
                                -------------+-----------------------------------------------------------------------------
                                Pre | . . . . . . .
                                Post | . . . . . . .

                                Then, I tried to remove the rw option and add the baseline controls as I would in an OLS.
                                It took about 8 minutes to run with a sample of 1000 units and 28 periods using 16gb of RAM an an I7 processor, but the standard errors were not estimated.

                                Code:
                                . lpdid tx_furto , unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) controls(c.bscontro#i.id) nevertreated
                                lpdid tx_furto, unit(id) time(panel) treat(trat3) pre_window(4) post_window(4) nevertreated controls(c.bscontro#i.id)
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                Warning: variance matrix is nonsymmetric or highly singular
                                
                                LP-DiD Event Study Estimates
                                
                                E-time | Coeffic~t SE t P>|t| [95% co~. interval] obs
                                -------------+-----------------------------------------------------------------------------
                                pre4 | 253.6607 0 . . 253.6607 253.6607 21023
                                pre3 | 70.52995 0 . . 70.52995 70.52995 21933
                                pre2 | 191.1218 0 . . 191.1218 191.1218 22843
                                pre1 | 0 . . . . . .
                                tau0 | -42.97887 0 . . -42.97887 -42.97887 23753
                                tau1 | 222.0593 0 . . 222.0593 222.0593 22843
                                tau2 | 162.7009 0 . . 162.7009 162.7009 21933
                                tau3 | 392.0703 0 . . 392.0703 392.0703 21023
                                tau4 | 536.738 0 . . 536.738 536.738 20113
                                
                                LP-DiD Pooled Estimates
                                
                                | Coeffic~t SE t P>|t| [95% co~. interval] obs
                                -------------+-----------------------------------------------------------------------------
                                Pre | 171.775 0 . . 171.775 171.775 21023
                                Post | 251.6097 0 . . 251.6097 251.6097 20113
                                
                                .
                                end of do-file


                                Anyway, thanks for the response and the explanation!
                                Very useful package! Will eagerly wait for the new versions.

                                With best regards,
                                Hi Bruno,

                                I don't know what is your setting here, but the set of covariates seems to be such that parameters are not identified in your model. It seems to be a problem with the model you are trying to estimate, which might not be identified given your data.

                                If you have reason to think that this is instead related to the STATA version you are using, then I would suggest asking someone with a later version of STATA to run your codes and see if it's different.

                                I do have good news regarding the speed of the regression adjustment (RA) specification: we will soon issue an updated version of the lpdid command where specifications that need to use RA will be *much* faster.

                                All the best,

                                Daniele

                                Comment

                                Working...
                                X