0

I'm not sure if this is a question for StackOverflow or CrossValidated, as the question relates both to coding and statistics.

I have a panel data with information about sewage and water privatization in 82 municipalities between 1998 and 2020. For each year and municipality, I have the hospitalization per inhabitants for diseases caused by sanitation problems, such as diarrhea. The thing is, I only saw examples of two way fixed effects with A UNIQUE treatment in a specific year but in my sample I have treatment in many periods. I mean, they occurred in 2007 for a municipality, then 2010 for another and so on.

Variables: treatment: dummy measuring 1 for treated observations at some point in time, and 0 for the never treated group; water: dummy measuring 1 after water privatization (post-treatment), 0 for never treated group or pre-treatment; sewage: dummy measuring 1 after sewage privatization (post-treatment), 0 for never treated group or pre-treatment.

I´ve tried the code in R using fixest package:

sanitation <- sanitation %>% mutate(
   treat_w = treatment*water,
   treat_s = treatment*sewage,
   treat_and = treatment*water*sewage,
   treat_or = treatment*ifelse(water==1 | sewage == 1 , 1, 0))

reg_1 <- feols( ratio_hospitalization ~ treat_w | year_ref + cod_mun, data = sanitation)
reg_2 <- feols( ratio_hospitalization ~ treat_s | year_ref + cod_mun, data = sanitation)
reg_3 <- feols( ratio_hospitalization ~ treat_and | year_ref + cod_mun, data = sanitation)
reg_4 <- feols( ratio_hospitalization ~ treat_or | year_ref + cod_mun, data = sanitation)

summary(reg_1)
summary(reg_2)
summary(reg_3)
summary(reg_4)

etable(reg_1, reg_2, reg_3, reg_4,
         vcov = "twoway", headers = c("Water", "Sewage", "Water and Sewage", "Water or Sewage"))

The results are shown in the image. R results

I´m not quite sure about it because all the examples I saw on the internet were with ONE treatment. Is it correct to use this code for multiple time treatments? Is there anyone here who can help me with this?

Hobo
  • 7,536
  • 5
  • 40
  • 50

0 Answers0