synthout <- base_para_synth %>%
synthetic_control(outcome = TasaHomicidios,
unit= Alcaldia,
time= Tiempo,
i_unit = "AlvaroObregon",
i_time = 20,
generate_placebos = T) %>%
generate_predictor(time_window = 1:20, Gini =mean(Gini, na.rm=T)) %>%
generate_predictor(time_window = 1:20, PoblacionenExtremaPobreza= mean(Poblacionenextremapobreza, na.rm=T))%>%
generate_predictor(time_window = 1:20, Densidad= mean(Densidad, na.rm=T))%>%
generate_predictor(time_window = 1:20, IDH =mean(IDH, na.rm=T))%>%
generate_predictor(time_window = 1:20, Percepciondeinseguridad =mean(Percepciondeinseguridad, na.rm=T))%>%
generate_predictor(time_window = 1:20, ConfianzaenPolicia =mean(ConfianzaenPolicia, na.rm=T))%>%
generate_predictor(time_window = 1:20, Conflictos= mean(Conflictos, na.rm=T))%>%
generate_predictor(time_window = 1:20, Disparos = mean(Disparos, na.rm=T))%>%
generate_predictor(time_window = 1:20, Drogas =mean(Drogas, na.rm=T))%>%
generate_weights(optimization_window = 1:20,
margin_ipop = .02, sigf_ipop = 7, bound_ipop = 6) %>%
generate_control()
synthout %>% plot_trends()+labs(title="Time Series of the synthetic and observed Homicide Rate", x="Time", y="Homicide Rate")
synthout %>% plot_differences()+labs(x="Time", y= "Homicide Rate")
Create the figure in the solution for Problem 2, using the data included in the R Markdown file.
synthout %>% plot_weights()
synthout %>% plot_placebos()+labs(x="Time", y="Homicide Rate")
synthout%>% plot_mspe_ratio()
synthout %>% grab_significance()