I am working on a sugar tax evaluation, using an interrupted time series model that accounts for two implementation periods where the sugar tax increased. I am having trouble graphing the counterfactual line for the two periods after the interventions. As a note: I have used itsa as well, but this user-written command does not allow me to add the counterfactual lines to the graph. Therefore, I have estimated the equation using newey and interaction for each of the tax periods - the first tax is inclusive of weeks 1 to 37; tax 2 is inclusive of weeks 63 to 103. Below is the code I have been using to plot my graph, however the counterfactual plot does not match the results I am getting with itsa, nor does it make theoretical sense, as the estimates plotted do not overlap the fitted values, even when the itsa command returns non-significant results. Either my code to include the two treatment periods is incorrectly specified, or my prediction equations are incorrect. Any help would be greatly appreciated Ariel Linden!
Note: vpc is my outcome of interest, which stands for volume per capita, newid is the type of product I am looking at, in this example, newid ==2 is the non-sugary drinks.
itsa command:
itsa vpc overall trend holidays season, single treat(2) trperiod(37 63) lag(1) posttrend figure
manual command to make graph with counterfactuals plotted in it:
* regression
newey vpc tax1 tax1#c.week tax2 tax2#c.week tax1#tax2 overall trend holidays season if newid==2, lag(1)
* generate predicted values based on model
predict pred if newid==2
* generate the counterfactual
gen pred1 = pred - _b[tax1] if tax1==1 & tax2==0 & newid==2
gen pred2 = pred - _b[tax1] - _b[tax2] if tax1==1 & tax2==1 & newid==2
* plot scatter graph
twoway (scatter vpc week if newid==2) ///
(line pred week, lcolor(black)) ///
(line pred1 week, lcolor(black) lpattern(dash)) ///
(line pred2 week, lcolor(black) lpattern(dash)) , ///
xline(37 63) ///
legend(order(1 "Weekly sales" 2 "Fitted values" 3 "Counterfactual")) ///
ytitle("Weekly sales (fl oz/capita)")
If useful, the taxes are defined as following:
gen tax1 = 1 if week >= 37
replace tax1 = 0 if week < 37
lab var tax1 "Tax 1 (@Week 37)"
lab def tax 0 "Pre-tax" 1 "Post-tax"
gen tax2 = 1 if week >= 63
replace tax2 = 0 if week < 63
lab var tax2 "Tax 2 (@Week 63)"
Thanks in advance for any support,
Alexa Segal (PhD Candidate at Imperial College London)
Related Posts with Interrupted time series with multiple treatment periods
interflex command failedHello everyone, I have a problem with the results of the interflex command. I had tried to look if …
Tabulation only for freq>=5Hello, I am running this tabulate command to display some studentized residuals: tabulate cname if …
Converting ExcelI need to import 3 excel files with different columns/rows into Stata. Excel #1 looks like this: …
Putexcel command for logistic regressionHello there I'm trying to make a nice table for my logistic regression results using putexcel comma…
Difference in Difference EstimationDear All, My goal is to find out the impact of migration on several firm level performance measures…
Subscribe to:
Post Comments (Atom)
0 Response to Interrupted time series with multiple treatment periods
Post a Comment