In: Economics
You have monthly data on gasoline prices in two cities—Vancouver and Toronto, for the years 2006–2010. In each month of each year, you observe the average price of gasoline in each city. Prices in Vancouver are usually higher than in Toronto, but the cities follow similar price trends, as prices rise in the summer months and respond similarly to demand and cost shocks. However, there are month-to-month fluctuations for various reasons.
Starting from January 1, 2008, Vancouver imposed a carbon tax which was expected to be reflected in higher gasoline prices. Explain how you would use a difference-in- differences framework to estimate the effect of the carbon tax. Carefully define any new variables you need based on the data provided. Then, write down a line of R code which will run the regression you need. Make sure you point out which regression coeffcient is the desired estimate.
The difference in differences (DID) method is used to estimate the treatment effect on the treated sample of the data. To use DID, we require a control and treatment unit with pre and post-intervention in the dataset.
In this case, control and treatment units are Toronto and Vancouver respectively with pre and post-intervention by a carbon tax (before and after January 1, 2008) which makes this setup suitable to implement DID. Assuming, sample data follow assumptions such as parallel trends, exchangeability, positivity, and SUTVA.
DID regression model to estimate the effect of a carbon tax is -
Prices = β0 + β1*[Time] + β2*[Intervention] + β3*[Time*Intervention] +ε
where Time is a dummy variable which takes a value 0 before January 1, 2008, and 1 otherwise. Intervention is a dummy variable for the treated unit that takes a value 0 in the case of Toronto (control unit) and 1 if the city is Vancouver (treated unit). Lastly, the interaction of Time and Intervention is the DID variable.
R code to estimate would be -
DID_reg = lm(Prices ~ time + intervention+ time*intervention(did), data = mydata)
where my data is the name of the data. The coefficient on time*intervention (β3) would indicate the difference in changes over time and the main coefficient of interest.