Announcement

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

  • did_multiplegt_dyn control variables

    Dear Statalist,

    I am running a staggered TWFE with dynamic/heterogenous effects and a continuous treatment. My code is as follows:
    did_multiplegt_dyn price myid monthyear capacity, effects(5) placebo(4) cluster(myid) save_sample

    I have a panel data of 60 period(monthyear) from 2016 to 2020 and I am interesting on the impact of the independent variable - capacity change (continuous variable) on the dependent variable - market price (continuous variable).

    The code above runs fine but failed when I tried to include a control variable - invest (also a continuous variable, and vary across monthyear). The code that fail is as follows:
    did_multiplegt_dyn price myid monthyear capacity, controls(invest) effects(5) placebo(4) cluster(myid) save_sample

    I got an error message of "no observations". And I got the same error message regardless what variable I feed into controls().

    Does anyone know what is leading this issue?

    Thank you.

  • #2
    Hi, I ran into the same question; I still have 3500 observations without missing any variable, but I still got the error message of "no observations." I wonder if you have solved this problem? Thank you.

    Comment


    • #3
      Dear Yifei and Zheng,
      Yifei, as you mentioned in your post, your treatment is continuous. When running did_multiplegt_dyn with controls, basically the command is ruling out the effects on the outcome of your control variables (Cf the parallel trends assumption with controls in the web appendix of Difference-in-Differences Estimators of Intertemporal Treatment Effects by Clément de Chaisemartin, Xavier D'Haultfœuille :: SSRN: Section 1.2 Controlling for covariates). To do so, for each baseline value of your treatment, let's say d, the command restricts the sample to units such that their baseline treatment is equal to that level d, call it the subampled, and runs a regression of the variation of the outcome on the variation of the controls to estimate \thetad. However, if your treatment is continuous, it's likely to have a subampled with only one observation (in a case where only one unit has the baseline value d) leading to the usual error of insufficient observations in stata.
      So, one suggestion is to use the option continuous that is now available in the new version of did_multiplegt_dyn. Hope this will help you solve the problem!
      You can also take a look at Difference-in-Differences for Continuous Treatments and Instruments with Stayers by Clément de Chaisemartin, Xavier D'Haultfœuille, Félix Pasquier, Gonzalo Vazquez‐Bare :: SSRN, if you are interested in DID designs with continuous treatments in general.
      Best,
      Doulo
      Last edited by Doulo SOW; 30 Apr 2024, 15:44.

      Comment

      Working...
      X