Hi everyone,
I’m working with panel data where each patient (patient_id) is followed from 2010–2020.
The treatment (disease_on) switches from 0 to 1 starting in the year a patient develops a certain disease, and stays 1 afterward. Controls are the ones who never develop the disease and (disease_on) is 0 during all years.
Here’s what I did so far:
I have tried estate trendplot but its not working because the year that the disease happens is not the same for all patients (heterogeneous).
What’s the correct way in Stata to aggregate matched treated and control observations so I can plot smooth mean trajectories around the event (say −5 to +5 years)?
Any guidance or example code for producing a clear “treated vs. control around the event year” graph after matching and heterogeneous DID would be really appreciated.
Thanks!
I’m working with panel data where each patient (patient_id) is followed from 2010–2020.
The treatment (disease_on) switches from 0 to 1 starting in the year a patient develops a certain disease, and stays 1 afterward. Controls are the ones who never develop the disease and (disease_on) is 0 during all years.
Here’s what I did so far:
- Matched treated and untreated patients year-by-year using kmatch ps ... wor att nn(1) generate, keeping only matched controls
- Then ran:
- xthdidregress ra (outcome variable) (disease_on), group(patient_id)
which estimates cohort- and time-specific ATETs. - I can plot event-time effects using estat atetplot, ci, and I can test pretreatment differences with estat ptrends.
I have tried estate trendplot but its not working because the year that the disease happens is not the same for all patients (heterogeneous).
What’s the correct way in Stata to aggregate matched treated and control observations so I can plot smooth mean trajectories around the event (say −5 to +5 years)?
Any guidance or example code for producing a clear “treated vs. control around the event year” graph after matching and heterogeneous DID would be really appreciated.
Thanks!
