Hi,
I am trying to use the xthdidregress with panel data (STATA 18). I am looking at the implementation of a poverty alleviation program in India, using elections as a `treatment' (to determine whether constituencies held by the incumbent see more spending). I have panel data for 10 fiscal years, which I reshaped as long before running xtset and xthdidregress. There are two elections in the dataset, so basically two `treatments' (so two time periods, and two cohorts as a result). I have created a treatment variable for each of the fiscal years, coded as 1 when the incumbent at the state level holds the constituency and 0 otherwise. I have also reshaped these treatment variables, which is why I only type 'treatedac' rather than the full form for each fiscal year ('treatedac12' 'treatedac13' etc.)
Whenever I run xthdidgress, I get the following error, and I am not sure where this is coming from. I highly suspect this has to do with the way I coded the treatment variable (or the way I am using it), but not sure why... STATA 18 should be able to handle heterogenous treatment under this specification right? When I look at the data editor, I see that STATA recognized the second treatment (the election of 2017), but not the first (the elections of 2012).
Here's the code:
. xthdidregress ra (logtotpdac prop_poor) (treatedac), group(ac)
note: variable _did_cohort, containing cohort indicators formed by treatment variable treatedac and
group variable ac, was added to the dataset.
invalid treatment
The treatment is assumed to be staggered. Once a unit is treated, it should remain treated.
r(498);
Thanks for letting me know!
I am trying to use the xthdidregress with panel data (STATA 18). I am looking at the implementation of a poverty alleviation program in India, using elections as a `treatment' (to determine whether constituencies held by the incumbent see more spending). I have panel data for 10 fiscal years, which I reshaped as long before running xtset and xthdidregress. There are two elections in the dataset, so basically two `treatments' (so two time periods, and two cohorts as a result). I have created a treatment variable for each of the fiscal years, coded as 1 when the incumbent at the state level holds the constituency and 0 otherwise. I have also reshaped these treatment variables, which is why I only type 'treatedac' rather than the full form for each fiscal year ('treatedac12' 'treatedac13' etc.)
Whenever I run xthdidgress, I get the following error, and I am not sure where this is coming from. I highly suspect this has to do with the way I coded the treatment variable (or the way I am using it), but not sure why... STATA 18 should be able to handle heterogenous treatment under this specification right? When I look at the data editor, I see that STATA recognized the second treatment (the election of 2017), but not the first (the elections of 2012).
Here's the code:
. xthdidregress ra (logtotpdac prop_poor) (treatedac), group(ac)
note: variable _did_cohort, containing cohort indicators formed by treatment variable treatedac and
group variable ac, was added to the dataset.
invalid treatment
The treatment is assumed to be staggered. Once a unit is treated, it should remain treated.
r(498);
Thanks for letting me know!
Comment