Announcement

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

  • Event Study with Uneven Time Gaps (Every 2 Years) — “Lead or lag term not found” Error

    Hello everyone,

    I’m working with panel data that contains school-level outcomes (grades) for the years 2015, 2017, 2019, 2021, and 2023. Treatment occurred in 2017, and I created a "time2treat" variable where:
    • 2015 → -2
    • 2017 → 0
    • 2019 → 2
    • 2021 → 4
    • 2023 → 6
      (and similarly for earlier years like 2013 → -4, 2011 → -6, etc.)
    I tried running the eventdd command using time2treat as the time variable and setting baseline (-2), but I always get the following error:

    "Lead or lag term not found in the range of the event study plot. Ensure that the indicated timevar() has full coverage for all leads and lags, or attempt accumulating leads and lags using the accum option."

    From what I understand, the command requires consecutive time periods (e.g., -3, -2, -1, 0, 1, 2), but my dataset only has observations every two years.

    I’ve read a pdf with instructions to use this command and tried using baseline(), accum, and other options like lags(), leads(), and inrange() — none of them seem to solve this issue. Has anyone dealt with a similar situation?
    • Is there any way to run eventdd without full consecutive leads/lags?
    • Or would I need to write a custom event study manually using reghdfe and then graph it myself?
    Thank you for your help

  • #2
    Originally posted by Lina Santos View Post

    From what I understand, the command requires consecutive time periods (e.g., -3, -2, -1, 0, 1, 2), but my dataset only has observations every two years.
    Redefining the time period shouldn't change anything, so you can map 2015 to -1, 2017 to 0, 2019 to 1, and so on. In your setup, one unit corresponds to two years.

    Comment


    • #3
      Agree with Andrew. Simply define a new variable that runs from t = 1, 2, 3, 4, 5 and use it as the time variable. Afterwards, you can relabel.

      Which command are you using? If you want covariates to be entered completely flexibly, I recommend jwdid with the never option.

      Code:
      gen cohort = 0
      replace cohort = 2 if treated
      jwdid y x1 ... xK, ivar(id) tvar(t) gvar(cohort) never
      estat event
      estat plot
      estat simple

      Comment


      • #4
        Pedantically (or otherwise): the gaps are consistent and not at all uneven.

        See also for this kind of fime series.

        Code:
        SJ-24-4 st0764  . . . . . . . . . . . Stata tip 158: The devil is in the delta
                . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
                Q4/24   SJ 24(4):777--783                                (no commands)
                underlines that the delta() option of tsset or xtset is
                essential in many cases, even though as the term implies,
                it is optional as a matter of syntax
        https://journals.sagepub.com/doi/pdf...6867X241297950

        Comment

        Working...
        X