Hi everyone. I have panel data on US schools from 2008 to 2017. In 2013, a bill was passed and some schools have received benefits from it. Now, I want to estimate the effects of this bill on maths scores with a diff-in-diff model. The dataset looks like this:
And the model is: maths_score = i.id + i.year + beta_t * treatment.
Important: notice that the treatment variable is equal to 1 for all the treated schools even before 2013, the year in which the bill was passed.
Now, I want to estimate the beta_t for each year from 2008 to 2017 and I am trying to use the code
to do so, in which I take 2013 as the base variable. The problem is that, if I do this, Stata says that the model is not identified and the treatment variable treat was omitted because of collinearity. I think it is because treatment = 1 for each year from 2008 to 2017, so if I include both the year and the treatment variable, I have a problem of multicollinearity. But if I do
have solved the multicollinearity problem, but I can no longer compute the beta_t for all the years prior to 2013.
I have also tried
Which returns an output, but I am not sure whether this is the correct specification.
So, my question is: how can I adapt this model using Stata so that I am able to correctly compute all the beta_t from 2008 and 2017, excluding 2013 which is my base category?
Code:
year id treatment maths_score 2008 10 0 2.011 2009 10 0 2.017 2010 10 0 2.435 2011 10 0 2.876 2012 10 0 2.888 2013 10 0 2.921 2014 10 0 3.001 2015 10 0 3.089 2016 10 0 3.110 2017 10 0 3.221 2008 20 1 2.425 2009 20 1 2.552 2010 20 1 2.598 2011 20 1 2.655 2012 20 1 2.701 2013 20 1 3.012 2014 20 1 3.114 2015 20 1 3.302 2016 20 1 3.556 2017 20 1 3.773
Important: notice that the treatment variable is equal to 1 for all the treated schools even before 2013, the year in which the bill was passed.
Now, I want to estimate the beta_t for each year from 2008 to 2017 and I am trying to use the code
Code:
xtdidregress (maths_score b2013i.year#treatment) (treatment), group(id) time(year) aequations allbaselevels vce(cluster id)
Code:
replace treatment = 0 if year < 2013
I have also tried
Code:
regress maths_score ib2013.year##i.treatment i.id
So, my question is: how can I adapt this model using Stata so that I am able to correctly compute all the beta_t from 2008 and 2017, excluding 2013 which is my base category?
Comment