Announcement

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

  • Difference-in-Differences with Multiple Time Periods

    Dear Stata community,

    I am currently working with an unbalanced panel dataset and would greatly appreciate your guidance on implementing a Difference-in-Differences (DiD) approach using the Callaway & Sant’Anna (2020) methodology (via csdid).

    My dataset consists of daily observations from environmental monitoring stations, which measure air pollution indicators such as PM2.5 and PM10. The panel is unbalanced because not all stations report data continuously over time, and in some cases, entire periods are missing for certain pollutants.

    The unit of observation is the monitoring station, and each station is located within a municipality. The treatment corresponds to municipality where a station is located has implemented a environmental policy.

    I define the treatment timing variable (gvar) as the date of the policy implementation in the municipality. In practice, I construct this variable at the unit level (station) so that it remains constant over time within each unit. Specifically, I use the following Stata code:
    bysort id_polution_station: egen gvar_d = min(date_policy_approval) replace gvar_d = 0 if missing(gvar_d) format gvar_d %td
    This ensures that:
    • All observations for a treated unit share the same treatment adoption date.
    • Units that are never treated are assigned gvar = 0.
    Given this setup, I would like to ask the following:
    1. Are there any recommended best practices when dealing with irregular reporting frequency or missing periods in high-frequency environmental data?
    2. In this context, would it be preferable to rely on never-treated units as controls, or should I use the notyet option to include not-yet-treated units as well?
    Any advice on model specification, data preparation, or potential pitfalls would be highly appreciated.

    Thank you very much in advance for your help.

    Best regards,

  • #2
    Can you aggregate to week or month and get rid of some of the missing? csdid can handle unbalanced data, but you want to make sure it's not unbalanced in a way that may cause bias.

    either never/notyet are ok. maybe do both. not yet is useful when you have few observations, but that's unlikely an issue for you.

    Comment


    • #3
      Before aggregating, I would check how reporting varies by pollutant, station, municipality, and treatment status. A monthly average based on two reporting days can represent a different part of the month from an average based on thirty days. Weekly or monthly aggregation can be useful, but the rule for forming those averages and the calendar of policy adoption need to be explicit.

      For each treatment cohort, count stations with nonmissing pollution measurements at both endpoints of each comparison, separately for the cohort and eligible controls. Also check whether reporting changes around policy introduction. For gvar_d, a missing policy date should be coded zero only when you know that the municipality was never treated.

      Never-treated controls require a credible untreated trend comparison throughout the window. Not-yet-treated controls add comparisons while those municipalities remain untreated, under the corresponding parallel-trends and no-anticipation assumptions. I would choose from the policy setting and then report how control support changes across dates.

      You can also use the cdid package for this (`ssc install cdid`, see https://github.com/dvbn/cdid-stata). It combines supported within-station changes across overlapping intervals, so different stations can contribute different links. Chained DiD paper spells out the identification conditions formally: https://arxiv.org/abs/2301.01085

      Those conditions concern representativeness in mean pollution changes. If station characteristics predict both reporting and pollution changes, cdid offers observation weighting, actual-change imputation, and an augmented correction under conditional mean-change representativeness and adequate support. After a chained fit, cdid_diagnostics and cdid_chain show the stored diagnostics and which comparisons contribute to each effect.

      Comment

      Working...
      X