# PBC IN LATAM: A DYNAMIC PANEL ANALYSIS # Author: Erick Alvarez Barreno # June 2021 # Libraries: library(openxlsx) library(tidyverse) library(ggplot2) library(ggpubr) library(stargazer) library(plm) # Information for the Dynamic Panel Analysis: ## https://cran.r-project.org/web/packages/plm/plm.pdf # Database available here: ## https://drive.google.com/drive/folders/1-GPe8CjeUvPYNdzYO4UUmWBZGpH4rYYX?usp=sharing # Import the database PBC_Database<- read.xlsx("C:/Users/User/Desktop/Revisión Artículo Antioquia/PBC_Database.xlsx") glimpse(PBC_Database) # Create the log of Realgdpcapg: PBC_Database <- PBC_Database %>% mutate(log_realgdpcapg = log(Realgdpcapg)) %>% mutate(Unemp = as.double(Unemp)) # Filter the US out the database: PBC_Database <- PBC_Database %>% filter(COUNTRY != "United States") # Create levels of Presidential approval (high approval as base category): PBC_Database <- PBC_Database %>% mutate(Low_execapp = ifelse(test = ExecApp < 40, yes = 1, no = 0), Low_execapp = ifelse(test = ExecApp >= 40, yes = 0, no = 1), Med_execapp = ifelse(test = ExecApp >= 40 & ExecApp <= 60, yes = 1, no = 0), Med_execapp = ifelse(test = ExecApp < 40 | ExecApp > 60, yes = 0, no = 1)) # Create one lag and one lead for electoral years to test what government year matters: PBC_Database <- PBC_Database %>% mutate(LagElect_1 = ifelse(test = dplyr::lead(Elect, 1), yes = 1, no = 0), LeadElect_1 = ifelse(test = dplyr::lag(Elect, 1), yes = 1, no = 0)) # Table 1. Descriptive Statistics stargazer(select(PBC_Database, Elect, LeadElect_1, LagElect_1, CurrExp, CapExp, ExecApp, Taxes, Unemp, Gdpg, log_realgdpcapg), type = "text", summary.stat = c("n", "mean", "sd", "min", "max"), digits = 2, header = FALSE, covariate.labels = c("Año electoral", "Año poselectoral", "Año preelectoral", "Gasto corriente (% del PIB)", "Gasto de capital (% del PIB)", "Nivel de aprobación presidencial", "Ingresos tributarios (% del PIB)", "Desempleo (% total fuerza laboral)", "Tasa crecimiento del PIB", "Log PIB per cápita real"), style = "qje", out = "Table_1.doc") # Treat electoral dummies as factors: PBC_Database <- PBC_Database %>% mutate(Elect = as.factor(Elect), LagElect_1 = as.factor(LagElect_1), LeadElect_1 = as.factor(LeadElect_1)) # Boxplot: Electoral dynamics and government spending A <- PBC_Database %>% filter(!is.na(Elect)) %>% ggplot(aes(x = Elect, y = CurrExp, fill = factor(Elect))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "", x = "Año electoral") B <- PBC_Database %>% filter(!is.na(LagElect_1)) %>% ggplot(aes(x = LagElect_1, y = CurrExp, fill = factor(LagElect_1))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "Gasto corriente (% del PIB)", x = "Año preelectoral") C <- PBC_Database %>% filter(!is.na(LeadElect_1)) %>% ggplot(aes(x = LeadElect_1, y = CurrExp, fill = factor(LeadElect_1))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "", x = "Año poselectoral") ## Graph 1: Electoral dynamics and current expenditure Graph_1 <- ggarrange(B, A, C + font("x.text", size = 10), ncol = 3, nrow = 1) Graph_1 D <- PBC_Database %>% filter(!is.na(Elect)) %>% ggplot(aes(x = Elect, y = CapExp, fill = factor(Elect))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "", x = "Año electoral") E <- PBC_Database %>% filter(!is.na(LagElect_1)) %>% ggplot(aes(x = LagElect_1, y = CapExp, fill = factor(LagElect_1))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "Gasto de capital (% del PIB)", x = "Año pre-electoral") G <- PBC_Database %>% filter(!is.na(LeadElect_1)) %>% ggplot(aes(x = LeadElect_1, y = CapExp, fill = factor(LeadElect_1))) + geom_boxplot() + theme_classic() + geom_jitter(width = 0.1, alpha = 0.2) + guides(fill = FALSE) + scale_fill_manual(values = alpha(c("grey40", "grey40"), 0.20)) + labs(y = "", x = "Año post-electoral") ## Graph 2: Electoral dynamics and capital expenditure Graph_2 <- ggarrange(E, D, G + font("x.text", size = 10), ncol = 3, nrow = 1) Graph_2 # Graph 3. Impact of election year on current expenditure Graph_3 <- PBC_Database %>% group_by(COUNTRY, Elect) %>% dplyr::summarise(CurrExp = mean(CurrExp, na.rm = TRUE)) %>% ungroup() %>% reshape2::dcast(COUNTRY ~ Elect, mean, value.var = "CurrExp", na.rm = TRUE) %>% dplyr::rename(Elect_year = "1", Nonelect_year = "0") %>% mutate(Dif_elect = Elect_year - Nonelect_year) currexp_LATAM <- read.xlsx("C:/Users/User/Desktop/Revisión Artículo Antioquia/Mean Latam.xlsx", sheet = 1) Graph_3 <- rbind(Graph_3, currexp_LATAM) ggplot(Graph_3, aes(x = reorder(COUNTRY, Dif_elect), y = Dif_elect)) + geom_bar(stat = "identity", fill = "grey40", colour = "black", alpha = .30) + coord_flip() + labs(title = "Variación del gasto corriente en porcentaje del PIB", x = "", y = "Diferencia del gasto corriente (% del PIB) entre años electorales y no electorales") + theme_classic() ## Graph 4. Impact of election on capital expenditure Graph_4 <- PBC_Database %>% group_by(COUNTRY, Elect) %>% dplyr::summarise(CapExp = mean(CapExp, na.rm = TRUE)) %>% ungroup() %>% reshape2::dcast(COUNTRY ~ Elect, mean, value.var = "CapExp", na.rm = TRUE) %>% dplyr::rename(Elect_year = "1", Nonelect_year = "0") %>% mutate(Dif_elect = Elect_year - Nonelect_year) capexp_LATAM <- read.xlsx("C:/Users/User/Desktop/Revisión Artículo Antioquia/Mean Latam.xlsx", sheet = 2) Graph_4 <- rbind(Graph_4, capexp_LATAM) ggplot(Graph_4, aes(x = reorder(COUNTRY, Dif_elect), y = Dif_elect)) + geom_bar(stat = "identity", fill = "grey40", colour = "black", alpha = .30) + coord_flip() + labs(title = "Variación del gasto de capital en porcentaje del PIB", x = "", y = "Diferencia en el gasto de capital (% del PIB) entre años electorales y no electorales") + theme_classic() # Brief Multicollinearity Diagnostics (problems with lags of the DV): library(mctest) X <- lm(formula = CurrExp ~ Elect + LagElect_1 + LeadElect_1 + CurrExplag1 + CurrExplag2 + Gdpg + log_realgdpcapg, data = PBC_Database) imcdiag(X) library(caret) car::vif(X) # Panel Data Analysis pdata <- pdata.frame(PBC_Database, index = c("COUNTRY", "YEAR")) CurrExp_FE_NApp <- plm(formula = CurrExp ~ Elect + LagElect_1 + LeadElect_1 + CurrExplag1 + CurrExplag2 + Gdpg + log_realgdpcapg, data = pdata, index = c("COUNTRY", "YEAR"), effect = "twoways", model = "within") summary(CurrExp_FE_NApp) CurrExp_FE_App <- plm(formula = CurrExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + CurrExplag1 + CurrExplag2 + Gdpg + log_realgdpcapg, data = pdata, index = c("COUNTRY", "YEAR"), model = "within", effect = "twoways") summary(CurrExp_FE_App) CapExp_FE_NApp <- plm(formula = CapExp ~ Elect + LagElect_1 + LeadElect_1 + CapExplag1 + CapExplag2 + Gdpg + log_realgdpcapg, data = pdata, index = c("COUNTRY", "YEAR"), model = "within", effect = "twoways") summary(CapExp_FE_NApp) CapExp_FE_App <- plm(formula = CapExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + CapExplag1 + CapExplag2 + Gdpg + log_realgdpcapg, data = pdata, index = c("COUNTRY", "YEAR"), model = "within", effect = "twoways") summary(CapExp_FE_App) ## Table 2. Estimated coefficients with fixed effects by country and year stargazer(CurrExp_FE_NApp, CurrExp_FE_App, CapExp_FE_NApp, CapExp_FE_App, covariate.labels = c("Año electoral", "Año pre-electoral", "Año post-electoral", "Aprobación media", "Aprobación baja", "Gasto corriente en t-1", "Gasto corriente en t-2", "Gasto de capital en t-1", "Gasto de capital en t-2", "Tasa de crecimiento del PIB", "Log PIB per cápita real"), dep.var.labels = c("Gasto corriente", "Gasto de capital"), type = "text", out = "Table_2.doc", align = TRUE, no.space = TRUE, omit.stat = c("LL","ser", "f")) ## Wooldridge test for serial correlation (Table 3) pbgtest(CurrExp_FE_NApp) pbgtest(CurrExp_FE_App) pbgtest(CapExp_FE_NApp) pbgtest(CapExp_FE_App) ## Breusch-Pagan test for Homoscedasticity (Table 4) library(lmtest) bptest(CurrExp ~ Elect + LagElect_1 + LeadElect_1 + CurrExplag1 + CurrExplag2 + Gdpg + log_realgdpcapg, data = pdata, studentize = FALSE) bptest(CurrExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + CurrExplag1 + CurrExplag2 + Gdpg + log_realgdpcapg, data = pdata, studentize = FALSE) bptest(CapExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + CapExplag1 + CapExplag2 + Gdpg + log_realgdpcapg, data = pdata, studentize = FALSE) bptest(CapExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + CapExplag1 + CapExplag2 + Gdpg + log_realgdpcapg, data = pdata, studentize = FALSE) ## Pesaran CD test for cross-sectional dependence (Table 5) pcdtest(CurrExp_FE_NApp, test = c("cd")) pcdtest(CurrExp_FE_App, test = c("cd")) pcdtest(CapExp_FE_NApp, test = c("cd")) pcdtest(CapExp_FE_App, test = c("cd")) ## Controlling for Heteroscedasticity and autocorrelation (Models 1 and 2) CurrNApp_Robust <- coeftest(CurrExp_FE_NApp, vcovHC(CurrExp_FE_NApp, method = "arellano")) CurrApp_Robust <- coeftest(CurrExp_FE_App, vcovHC(CurrExp_FE_NApp, method = "arellano")) ## Controlling for Heteroscedasticity (Models 3 and 4) CapNApp_Robust <- coeftest(CapExp_FE_NApp, vcovHC) CapApp_Robust <- coeftest(CapExp_FE_App, vcovHC) ## Table 6. Estimates with Robust Standard Errors stargazer(CurrNApp_Robust, CurrApp_Robust, CapNApp_Robust, CapApp_Robust, covariate.labels = c("Año electoral", "Año pre-electoral", "Año post-electoral", "Aprobación media", "Aprobación baja", "Gasto corriente en t-1", "Gasto corriente en t-2", "Gasto de capital en t-1", "Gasto de capital en t-2", "Tasa de crecimiento del PIB", "Log PIB per cápita real"), column.labels = c("Gasto corriente", "Gasto de capital"), column.separate = c(2, 2), type = "text", out = "Table_6.doc", align = TRUE, no.space = TRUE, omit.stat = c("LL","ser","f")) ## Generalized Method of Moments (GMM) GMM_CurrNApp <- pgmm(CurrExp ~ Elect + LagElect_1 + LeadElect_1 + lag(CurrExp, 1:2) + Gdpg + log_realgdpcapg | lag(CurrExp, 2:99) | lag(Elect, 1:2) + lead(Elect, 2), data = PBC_Database, index = c("COUNTRY", "YEAR"), effect = "individual", model = "onestep", subset = sample == 1, transformation = "d") summary(GMM_CurrNApp) GMM_CurrApp <- pgmm(CurrExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + lag(CurrExp, 1:2) + Gdpg + log_realgdpcapg | lag(CurrExp, 2:99) | lag(Elect, 1:2) + lead(Elect, 2), data = PBC_Database, index = c("COUNTRY", "YEAR"), effect = "individual", model = "onestep", subset = sample == 1, transformation = "d") summary(GMM_CurrApp) GMM_CapNApp <- pgmm(CapExp ~ Elect + LagElect_1 + LeadElect_1 + lag(CapExp, 1:2)+ Gdpg + log_realgdpcapg | lag(CapExp, 2:99) | lag(Elect, 1:2) + lead(Elect, 2), data = PBC_Database, index = c("COUNTRY", "YEAR"), effect = "individual", model = "onestep", subset = sample == 1, transformation = "d") summary(GMM_CapNApp) GMM_CapApp <- pgmm(CapExp ~ Elect + LagElect_1 + LeadElect_1 + Med_execapp + Low_execapp + lag(CapExp, 1:2) + Gdpg + log_realgdpcapg | lag(CapExp, 2:99) | lag(Elect, 1:2) + lead(Elect, 2), data = PBC_Database, index = c("COUNTRY", "YEAR"), effect = "individual", model = "onestep", subset = sample == 1, transformation = "d") summary(GMM_CapApp) # Table 7. Estimates with the Generalized Method of Moments stargazer(GMM_CurrNApp, GMM_CurrApp, GMM_CapNApp, GMM_CapApp, covariate.labels = c( "Año electoral", "Año pre-electoral", "Año post-electoral", "Aprobación media", "Aprobación baja", "Gasto corriente en t-1", "Gasto corriente en t-2", "Gasto de capital en t-1", "Gasto de capital en t-2", "Tasa de crecimiento del PIB", "Log PIB per cápita real"), column.labels = c("Gasto corriente", "Gasto de capital"), column.separate = c(2, 2), type = "text", out = "Table_7.doc", align = TRUE, no.space = TRUE, omit.stat = c("LL","ser","f", "N")) # Appendix # Gov. Expenditure components and electoral years per country: ## Argentina Elections_Arg <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Argentina", YEAR %in% c(1990:2017)) Argentina_Curr <- PBC_Database %>% filter(COUNTRY == "Argentina", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Arg$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Argentina_Cap <- PBC_Database %>% filter(COUNTRY == "Argentina", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Arg$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Argentina_Curr, Argentina_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Bolivia Elections_Bol <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Bolivia", YEAR %in% c(1990:2017)) Bolivia_Curr <- PBC_Database %>% filter(COUNTRY == "Bolivia", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Bol$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Bolivia_Cap <- PBC_Database %>% filter(COUNTRY == "Bolivia", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Bol$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Bolivia_Curr, Bolivia_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Brazil Elections_Bra <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Brazil", YEAR %in% c(1996:2017)) Brazil_Curr <- PBC_Database %>% filter(COUNTRY == "Brazil", YEAR %in% c(1996:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Bra$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 7) + theme_classic() Brazil_Cap <- PBC_Database %>% filter(COUNTRY == "Brazil", YEAR %in% c(1996:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Bra$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 7) + theme_classic() ggarrange(Brazil_Curr, Brazil_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Chile Elections_Chile <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Chile", YEAR %in% c(1990:2017)) Chile_Curr <- PBC_Database %>% filter(COUNTRY == "Chile", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Chile$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Chile_Cap <- PBC_Database %>% filter(COUNTRY == "Chile", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Chile$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Chile_Curr, Chile_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Colombia Elections_Col <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Colombia", YEAR %in% c(1990:2017)) Colombia_Curr <- PBC_Database %>% filter(COUNTRY == "Colombia", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Col$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Colombia_Cap <- PBC_Database %>% filter(COUNTRY == "Colombia", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Col$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Colombia_Curr, Colombia_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Costa Rica Elections_CosRica <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Costa Rica", YEAR %in% c(1990:2017)) CosRica_Curr <- PBC_Database %>% filter(COUNTRY == "Costa Rica", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_CosRica$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() CosRica_Cap <- PBC_Database %>% filter(COUNTRY == "Costa Rica", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_CosRica$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(CosRica_Curr, CosRica_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Dominican Republic Elections_DomRep <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Dominican Republic", YEAR %in% c(1990:2017)) DomRep_Curr <- PBC_Database %>% filter(COUNTRY == "Dominican Republic", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_DomRep$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() DomRep_Cap <- PBC_Database %>% filter(COUNTRY == "Dominican Republic", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_DomRep$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(DomRep_Curr, DomRep_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Ecuador Elections_Ecu <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Ecuador", YEAR %in% c(1990:2017)) Ecuador_Curr <- PBC_Database %>% filter(COUNTRY == "Ecuador", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Ecu$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Ecuador_Cap <- PBC_Database %>% filter(COUNTRY == "Ecuador", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Ecu$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Ecuador_Curr, Ecuador_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## El Salvador Elections_Salv <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "El Salvador", YEAR %in% c(1990:2017)) Salvador_Curr <- PBC_Database %>% filter(COUNTRY == "El Salvador", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Salv$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Salvador_Cap <- PBC_Database %>% filter(COUNTRY == "El Salvador", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Salv$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Salvador_Curr, Salvador_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Guatemala Elections_Guat <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Guatemala", YEAR %in% c(1990:2017)) Guatemala_Curr <- PBC_Database %>% filter(COUNTRY == "Guatemala", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Guat$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Guatemala_Cap <- PBC_Database %>% filter(COUNTRY == "Guatemala", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Guat$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Guatemala_Curr, Guatemala_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Haiti Elections_Haiti <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Haiti", YEAR %in% c(1990:2017)) Haiti_Curr <- PBC_Database %>% filter(COUNTRY == "Haiti", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Haiti$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Haiti_Cap <- PBC_Database %>% filter(COUNTRY == "Haiti", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Haiti$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Haiti_Curr, Haiti_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Honduras Elections_Hond <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Honduras", YEAR %in% c(1990:2017)) Hond_Curr <- PBC_Database %>% filter(COUNTRY == "Honduras", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Hond$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Hond_Cap <- PBC_Database %>% filter(COUNTRY == "Honduras", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Hond$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Hond_Curr, Hond_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Mexico Elections_Mex <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Mexico", YEAR %in% c(1990:2017)) Mex_Curr <- PBC_Database %>% filter(COUNTRY == "Mexico", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Mex$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Mex_Cap <- PBC_Database %>% filter(COUNTRY == "Mexico", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Mex$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Mex_Curr, Mex_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Nicaragua Elections_Nic <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Nicaragua", YEAR %in% c(1990:2017)) Nic_Curr <- PBC_Database %>% filter(COUNTRY == "Nicaragua", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Nic$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Nic_Cap <- PBC_Database %>% filter(COUNTRY == "Nicaragua", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Nic$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Nic_Curr, Nic_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Panama Elections_Pan <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Panama", YEAR %in% c(1990:2017)) Pan_Curr <- PBC_Database %>% filter(COUNTRY == "Panama", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Pan$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Pan_Cap <- PBC_Database %>% filter(COUNTRY == "Panama", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Pan$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Pan_Curr, Pan_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Paraguay Elections_Par <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Paraguay", YEAR %in% c(1990:2017)) Par_Curr <- PBC_Database %>% filter(COUNTRY == "Paraguay", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Par$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Par_Cap <- PBC_Database %>% filter(COUNTRY == "Paraguay", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Par$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Par_Curr, Par_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Peru Elections_Peru <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Peru", YEAR %in% c(1990:2017)) Peru_Curr <- PBC_Database %>% filter(COUNTRY == "Peru", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Peru$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Peru_Cap <- PBC_Database %>% filter(COUNTRY == "Peru", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Peru$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Peru_Curr, Peru_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Uruguay Elections_Uru <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Uruguay", YEAR %in% c(1990:2017)) Uru_Curr <- PBC_Database %>% filter(COUNTRY == "Uruguay", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Uru$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() Uru_Cap <- PBC_Database %>% filter(COUNTRY == "Uruguay", YEAR %in% c(1990:2017)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Uru$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 11) + theme_classic() ggarrange(Uru_Curr, Uru_Cap + font("x.text", size = 10), ncol = 1, nrow = 2) ## Venezuela Elections_Ven <- PBC_Database %>% select(COUNTRY, YEAR, Elect) %>% filter(Elect == "1", COUNTRY == "Venezuela", YEAR %in% c(1990:2014)) Ven_Curr <- PBC_Database %>% filter(COUNTRY == "Venezuela", YEAR %in% c(1990:2014)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CurrExp)) + geom_vline(xintercept = Elections_Ven$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto corriente (% del PIB)") + scale_x_continuous(n.breaks = 9) + theme_classic() Ven_Cap <- PBC_Database %>% filter(COUNTRY == "Venezuela", YEAR %in% c(1990:2014)) %>% ggplot(aes(x = YEAR)) + geom_line(aes(y = CapExp)) + geom_vline(xintercept = Elections_Ven$YEAR, color = "blue", linetype = 6) + labs(x = "", y = "Gasto de capital (% del PIB)") + scale_x_continuous(n.breaks = 9) + theme_classic() ggarrange(Ven_Curr, Ven_Cap + font("x.text", size = 10), ncol = 1, nrow = 2)