I am working through a difference-in-differences model. While I've learned a good deal browsing SE, I'd like to hear from someone more experienced with fixed effects if my model is correctly specified.

Background: I have approximately 15 years of data for 102 cities. Of the 102, 45 were assigned an annual intervention in years 13-16. The usual problems in consistency are present, with some places treating all four years, and others treating 1-3 of the four years, with or without gaps between treatment years. To correct for this, I created a variable called timeint, which is equal to 1 when the city received a treatment in a given year. I want to control for time and city fixed effects (from what I understand of the model.) Thus, I've specified the following model in R:

didreg1 = lm(incidencerate ~ citycode + year + timeint, data = totalset)

where incidencerate = rate of incidence of the outcome citycode = specific number indicating the city corresponding to the outcome (1000,1001,1002) year = year corresponding to the outcome (coded as 2002,2003,2004) timeint = treatment given during year (0,1)

I chose to keep time* and intervention* out of the final model because I believe they are accounted for through the timeint variable, and since I created timeint independently of them, it isn't higher order, thus they are not needed in the regression.

I'd love some input as to whether I'm understanding fixed effects correctly, and which variables are necessary to get the correct output.

Thanks in advance!

*time = 1 for all cities during one of the four intervention years, regardless of whether they received intervention *intervention = 1 for all cities chosen for the intervention, regardless of the associated year.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.