# Libraries
library(tidyverse)
library(cowplot)
library(lfe)
library(tikzDevice)
# Data
load("./data/diss_df.rda")
# generate cabinetINC label variable for plotting
diss_df$cabinetINClabel <- ifelse(diss_df$cabinetINC == 1, "Power-Sharing", 
                                    "No Power-Sharing")
plot_ps_corruption <- ggplot(diss_df, aes(x = cabinetINClabel, y = v2x_corr_t1)) + 
  geom_jitter(size = 1.5, alpha = 0.5) +
  geom_boxplot(aes(fill = cabinetINClabel), alpha = 0.6) +
  scale_fill_brewer(palette = "Blues") + 
  stat_summary(aes(group = 1), fun.y = mean, geom = "point", shape = 23,
               size = 4, fill = "#d7191c", color = "#d7191c") + 
  theme_bw() +
  theme(legend.position = "none", axis.text = element_text(size = 11)) +
  labs(x = "", y = "Political Corruption")
plot_allaid_corruption <- ggplot(diss_df, 
                               aes(x = log(aiddata_AidGDP), 
                                   y = v2x_corr_t1)) + 
  geom_point(alpha = 0.5) +
  geom_smooth(method = "lm") +
  theme_bw() +
  labs(x = "All Aid / GDP (log)", 
       y = "Political Corruption") 
# Output for Manuscript
# options( tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/aid_ps_individ_corruption.tex", height = 3.5)
# gridExtra::grid.arrange(plot_ps_corruption, plot_allaid_corruption, nrow = 1)
# dev.off()
# Output for Rep. Archive
gridExtra::grid.arrange(plot_ps_corruption, plot_allaid_corruption, nrow = 1)
Post-Conflict Particularistic vs. Public Spending
# Libraries
library(tidyverse)
library(rms)
library(gridExtra)
library(tikzDevice)
# Load data
load("data/diss_df.rda")
# to predict substantive effects from this model, we need to define data 
# distribution
diss_df$conflictID <- NULL
datadist_diss_df <- datadist(diss_df); options(datadist='datadist_diss_df')
# replicate Model from above with spending + cabCOUNT
model_aidps_spending <- ols(v2dlencmps_t1 ~
                              cabinetCOUNT *  
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_aidps_spending <- rms::robcov(model_aidps_spending, diss_df$GWNo)
# Start predictions for aid
prediction_democ_aid <- Predict(model_aidps_spending,
                           cabinetCOUNT = c(0, 10), # no / much power-sharing
                           aiddata_AidGDP_ln = seq(-5.7, 5.17, 0.1),# range of aid
                           conf.int = 0.9) 
subs_effects_spending_aid <- ggplot(data.frame(prediction_democ_aid), 
                                    aes(x = aiddata_AidGDP_ln, 
                                        y = yhat, 
                                        group = as.factor(cabinetCOUNT))) + 
  geom_line( color = "black", size = 1) + 
  geom_ribbon(aes(ymax = upper, 
                  ymin = lower, 
                  fill = as.factor(cabinetCOUNT)), 
              alpha = 0.7) +
  scale_fill_manual(values = c("#b3cde3", "#e41a1c"), 
                    name = "Number of Rebels \nin the Power-Sharing Coalition:") +
  theme_bw() +
  theme(text = element_text(size=8)) +
  labs(x = "Aid / GDP", 
       y = "Predicted Public vs. Particularistic Spending Values") +
  theme(legend.position = "bottom") 
# Predictions power-sharing
prediction_democ_ps <- Predict(model_aidps_spending, 
                              cabinetCOUNT = seq(0, 10, 1), 
                              aiddata_AidGDP_ln = c(0, 3.4),
                              conf.int = 0.9)
prediction_democ_ps$aiddata_AidGDP_ln <- round(exp(prediction_democ_ps$aiddata_AidGDP_ln))
subs_effects_spending_ps <- ggplot(data.frame(prediction_democ_ps), 
                                           aes(x = cabinetCOUNT, 
                                               y = yhat, 
                                               group = as.factor(aiddata_AidGDP_ln))) + 
  geom_line( color = "black", size = 1) + 
  geom_ribbon(aes(ymax = upper, 
                  ymin = lower, 
                  fill = as.factor(aiddata_AidGDP_ln)), 
              alpha = 0.7) +
  scale_fill_manual(values = c("#b3cde3", "#e41a1c"), 
                    name = "Aid in per cent of GDP:") +
  theme_bw() +
  scale_x_continuous(breaks = seq(0, 10, 2)) +
  theme(text = element_text(size=8)) +
  labs(x = "Power-Sharing (No. of rebel seats in government)", 
       y = "Predicted Public vs. Particularistic Spending Values") +
  theme(legend.position = "bottom") 
# output prediction plots
# output plot for predicted VDEM election quality variables 
 
# options( tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/aidps_spending.tex", height = 4.5, width = 6.5)
# grid.arrange(subs_effects_spending_ps,
#              subs_effects_spending_aid,
#              nrow = 1)
# dev.off()
grid.arrange(subs_effects_spending_ps, 
             subs_effects_spending_aid, 
             nrow = 1)
Goods: Individual Effects (Corruption as DV)
# Libraries
library(texreg)
source("functions/extract_ols_custom.R")
library(rms)
# load Data
load("./data/diss_df.rda")
# Power-Sharing Models
model_ps_corruption_cabcount <- ols(v2x_corr_t1 ~
                                     cabinetCOUNT +  
                                     aiddata_AidGDP_ln +
                                     ln_gdp_pc +
                                     ln_pop +
                                     conf_intens +
                                     nonstate +
                                     WBnatres + 
                                     fh,
                                   data=diss_df, x=T, y=T)
model_ps_corruption_cabcount <- rms::robcov(model_ps_corruption_cabcount, diss_df$GWNo)
model_ps_corruption_seniorcount <- ols(v2x_corr_t1 ~
                              seniorCOUNT  + 
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_ps_corruption_seniorcount <- rms::robcov(model_ps_corruption_seniorcount, diss_df$GWNo)
model_ps_corruption_nonseniorcount <- ols(v2x_corr_t1 ~
                              nonseniorCOUNT *  
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_ps_corruption_nonseniorcount <- rms::robcov(model_ps_corruption_nonseniorcount, diss_df$GWNo)
# Aid Models
model_dga_corruption <- ols(v2x_corr_t1 ~
                              cabinetCOUNT + 
                            log(dga_gdp_zero + 1) +
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_dga_corruption <- rms::robcov(model_dga_corruption, diss_df$GWNo)
model_pga_corruption <- ols(v2x_corr_t1 ~
                              cabinetCOUNT + 
                            log(program_aid_gdp_zero + 1) +
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_pga_corruption <- rms::robcov(model_pga_corruption, diss_df$GWNo)
model_bga_corruption <- ols(v2x_corr_t1 ~
                              cabinetCOUNT + 
                            log(commodity_aid_gdp_zero + 1) +
                              aiddata_AidGDP_ln +
                              ln_gdp_pc +
                              ln_pop +
                              conf_intens +
                              nonstate +
                              WBnatres + 
                              fh,
                            data=diss_df, x=T, y=T)
model_bga_corruption <- rms::robcov(model_bga_corruption, diss_df$GWNo)
model_list <- list(model_ps_corruption_cabcount, 
                   model_ps_corruption_seniorcount, 
                   model_ps_corruption_nonseniorcount,
                   model_dga_corruption, 
                   model_pga_corruption, 
                   model_bga_corruption)
coef_name_map <- list(
                      cabinetINC = "Power-Sharing (binary)",
                      "cabinetINC * aiddata_AidGDP_ln" = "Power-Sharing (binary) * Aid",
                      cabinetCOUNT = "Power-Sharing (cabinet)",
                                            seniorCOUNT = "Power-Sharing (senior)",
                      nonseniorCOUNT = "Power-Sharing (nonsenior)",
                      "cabinetCOUNT * aiddata_AidGDP_ln" = "Power-Sharing (cabinet) * Aid", 
                      "cabinetCOUNT:aiddata_AidGDP_ln" = "PS (cabinet) * Aid",
                      ps_share = "PS (cabinet share)",
                      "ps_share * aiddata_AidGDP_ln" = "PS (cabinet share) * Aid",
                      dga_gdp_zero = "DGA/GDP (log)", 
                      program_aid_gdp_zero = "Program Aid/GDP (log)", 
                      commodity_aid_gdp_zero = "Budget Aid/GDP (log)", 
                      aiddata_AidGDP_ln = "Aid / GDP (log)",
                      
                      ln_gdp_pc = "GDP p/c (log)",
                      ln_pop = "Population (log)",
                      conf_intens = "Conflict Intensity",
                      nonstate = "Non-State Violence",
                      WBnatres = "Nat. Res. Rents",
                      polity2 = "Polity",
                      fh = "Regime Type (FH)",
                      Ethnic = "Ethnic Frac.",
                      DS_ordinal = "UN PKO")
# custom functions to write tex output
source("./functions/custom_texreg.R")
environment(custom_texreg) <- asNamespace('texreg')
# 
# 
# # Output Manuscript
# custom_texreg(l = model_list,
#           stars = c(0.001, 0.01, 0.05, 0.1),
#           custom.coef.map = coef_name_map,
#        file = "../output/aid_ps_indeff_corr.tex",
#           symbol = "+",
#           table = F,
#           booktabs = T,
#           use.packages = F,
#           dcolumn = T,
#           include.lr = F,
#           include.rsquared = F,
#                  include.cluster = T,
# 
#           include.adjrs = T,
#         caption = "",
#               custom.multicol = T, 
#               custom.model.names = c(" \\multicolumn{3}{c}{ \\textbf{Power-Sharing}} & \\multicolumn{3}{c}{ \\textbf{Foreign Aid}} \\\\ \\cmidrule(r){2-4} \\cmidrule(l){5-7} & \\multicolumn{1}{c}{(1)  }",
#                                      "\\multicolumn{1}{c}{(2)  }",
#                                      "\\multicolumn{1}{c}{(3)  }",
#                                      "\\multicolumn{1}{c}{(4)  }",
#                                      "\\multicolumn{1}{c}{(5)   }",
#                                      "\\multicolumn{1}{c}{(6)   }"))
# Output Replication Archive
htmlreg(l = model_list, 
          stars = c(0.001, 0.01, 0.05, 0.1),
          custom.coef.map = coef_name_map,
          symbol = "+",
          table = F,
          booktabs = T,
          use.packages = F,
      
          dcolumn = T,
          include.lr = F,
          include.rsquared = F,
          include.adjrs = T,
          include.cluster = T,
        caption = "", 
        star.symbol = "\\*")| Model 1 | Model 2 | Model 3 | Model 4 | Model 5 | Model 6 | ||
|---|---|---|---|---|---|---|---|
| Power-Sharing (cabinet) | 0.00 | 0.00 | 0.00 | 0.00 | |||
| (0.00) | (0.00) | (0.00) | (0.00) | ||||
| Power-Sharing (senior) | 0.00 | ||||||
| (0.01) | |||||||
| Power-Sharing (nonsenior) | 0.01 | ||||||
| (0.02) | |||||||
| DGA/GDP (log) | -0.04 | ||||||
| (0.03) | |||||||
| Program Aid/GDP (log) | -0.05* | ||||||
| (0.03) | |||||||
| Budget Aid/GDP (log) | -0.00 | ||||||
| (0.02) | |||||||
| Aid / GDP (log) | -0.00 | -0.00 | -0.00 | 0.00 | 0.01 | -0.00 | |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.02) | ||
| GDP p/c (log) | -0.03 | -0.03 | -0.03 | -0.03 | -0.05+ | -0.03 | |
| (0.02) | (0.02) | (0.02) | (0.02) | (0.03) | (0.02) | ||
| Population (log) | 0.02 | 0.02 | 0.02 | 0.02+ | 0.02 | 0.02 | |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | ||
| Conflict Intensity | -0.04 | -0.04 | -0.04 | -0.03 | -0.03 | -0.04 | |
| (0.03) | (0.03) | (0.03) | (0.04) | (0.03) | (0.03) | ||
| Non-State Violence | 0.03 | 0.03 | 0.03 | 0.02 | 0.02 | 0.03 | |
| (0.03) | (0.03) | (0.03) | (0.03) | (0.03) | (0.03) | ||
| Nat. Res. Rents | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | |
| (0.00) | (0.00) | (0.00) | (0.00) | (0.00) | (0.00) | ||
| Regime Type (FH) | -0.06*** | -0.06*** | -0.06*** | -0.06*** | -0.06*** | -0.06*** | |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | ||
| Num. obs. | 273 | 273 | 273 | 273 | 273 | 273 | |
| Countries | 46 | 46 | 46 | 46 | 46 | 46 | |
| Adj. R2 | 0.43 | 0.43 | 0.42 | 0.43 | 0.44 | 0.42 | |
| ***p < 0.001, **p < 0.01, *p < 0.05, +p < 0.1 | |||||||
# Libraries
library(texreg)
source("functions/extract_ols_custom.R")
library(rms)
load("./data/diss_df.rda")
# Outliers
# Load outlier function
source("./functions/outlier_analysis.R")
# Estimate baseline model
model_spending_cabcount <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh ,
                      data=diss_df, x=T, y=T)
model_spending_cabcount <- rms::robcov(model_spending_cabcount, diss_df$GWNo)
# selector variables
selectvars = c("Location", "year", "identifiers")
diss_df$identifiers <- paste(diss_df$GWNo, diss_df$year, sep = "-")
# Estimate outliers
spending_outliers <- check_outlier(model_spending_cabcount, 
                                      data = diss_df,
                                      selectvars = selectvars, 
                                clustervar = "GWNo")
# Time 
model_spending_time <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh +
                          pcy + pcy2 + pcy3,
                      data=diss_df, x=T, y=T)
model_spending_time <- rms::robcov(model_spending_time, diss_df$GWNo)
# year FE
diss_df$yearFE <- as.factor(diss_df$year)
model_spending_yearfe <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh +
                        yearFE,
                      data=diss_df, x=T, y=T)
model_spending_yearfe <- rms::robcov(model_spending_yearfe, diss_df$GWNo)
# different cabinet aggregation types
model_spending_cabmax <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT_max * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh ,
                      data=diss_df, x=T, y=T)
model_spending_cabmax <- rms::robcov(model_spending_cabmax, diss_df$GWNo)
model_spending_cabmin <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT_min * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh ,
                      data=diss_df, x=T, y=T)
model_spending_cabmin <- rms::robcov(model_spending_cabmin, diss_df$GWNo)
model_spending_cabsix <- rms::ols(v2dlencmps_t1 ~  
                        cabinetCOUNT_six * 
                        aiddata_AidGDP_ln +
                        log(GDP_per_capita) +
                        log(population) +
                        conf_intens +
                        nonstate + 
                        WBnatres +
                        fh ,
                      data=diss_df, x=T, y=T)
model_spending_cabsix <- rms::robcov(model_spending_cabsix, diss_df$GWNo)
model_list <- list(spending_outliers[[2]], 
          spending_outliers[[4]],
          spending_outliers[[6]],
          model_spending_time, 
          model_spending_yearfe, 
          model_spending_cabmax, 
          model_spending_cabmin, 
          model_spending_cabsix)
coef_map <- list(cabinetCOUNT = "Power-Sharing (cabinet)",
                   cabinetCOUNT_max = "Power-Sharing (cabinet)",
                   cabinetCOUNT_min = "Power-Sharing (cabinet)",
                   cabinetCOUNT_six = "Power-Sharing (cabinet)",
                   "cabinetCOUNT * aiddata_AidGDP_ln" = "Power-Sharing (cabinet) * Aid", 
                   "cabinetCOUNT_max * aiddata_AidGDP_ln" = "Power-Sharing (cabinet) * Aid", 
                   "cabinetCOUNT_min * aiddata_AidGDP_ln" = "Power-Sharing (cabinet) * Aid", 
                   "cabinetCOUNT_six * aiddata_AidGDP_ln" = "Power-Sharing (cabinet) * Aid", 
                   aiddata_AidGDP_ln = "Aid / GDP (log)",
                   GDP_per_capita = "GDP p/c",
                   population = "Population",
                   conf_intens = "Conflict Intensity",
                   nonstate = "Non-State Violence",
                   WBnatres = "Nat. Res. Rents",
                   polity2 = "Polity", 
                 fh = "Regime Type (FH)", 
                   pcy = "Time", 
                   pcy2 = "Time$^2$", 
                   pcy3 = "Time$^3$")
# 
# texreg::texreg(model_list, 
#        stars = c(0.001, 0.01, 0.05, 0.1),
#        custom.coef.map = coef_map,
#        file = "../output/aidps_spending_tech_rob.tex",
#        symbol = "+",
#        table = F,
#        booktabs = T,
#        use.packages = F,
#        dcolumn = T,
#        include.lr = F,
#        custom.model.names = c("(1) Hat Values",
#                               "(2) Cook's Distance", 
#                               "(3) DFBETA", 
#                               
#                               "(4) Cubic Time Trend", 
#                                "(5) Year FE",
#                                "(6) PS: Max", 
#                                "(7) PS: Min", 
#                                "(8) PS: Six Months"),
#        include.adjrs = T,
#        caption = "", 
#        star.symbol = "\\*", 
#        include.rsquared = F,
#        include.cluster = T,
#        include.variance = F)
# Output Replication Archive
htmlreg(model_list, 
                stars = c(0.001, 0.01, 0.05, 0.1),
                custom.coef.map = coef_map,
                symbol = "+",
                table = F,
                booktabs = T,
                use.packages = F,
                dcolumn = T,
                 custom.model.names = c("(1) Hat Values",
                              "(2) Cook's Distance", 
                              "(3) DFBETA", 
                              
                              "(2) Cubic Time Trend", 
                               "(3) Year FE",
                               "(4) PS: Max", 
                               "(5) PS: Min", 
                               "(6) PS: Six Months"),
                include.lr = F,
                include.adjrs = T,
                caption = "", 
                star.symbol = "\\*", 
                include.rsquared = F,
                include.cluster = T,
                include.variance = F)| (1) Hat Values | (2) Cook’s Distance | (3) DFBETA | (2) Cubic Time Trend | (3) Year FE | (4) PS: Max | (5) PS: Min | (6) PS: Six Months | ||
|---|---|---|---|---|---|---|---|---|---|
| Power-Sharing (cabinet) | 0.63** | 0.13+ | 0.31*** | 0.12+ | 0.10 | 0.13** | 0.11 | 0.11 | |
| (0.22) | (0.08) | (0.08) | (0.07) | (0.07) | (0.05) | (0.08) | (0.07) | ||
| Power-Sharing (cabinet) * Aid | -0.24* | -0.05* | -0.12*** | -0.04* | -0.04+ | -0.04** | -0.05+ | -0.04* | |
| (0.11) | (0.02) | (0.03) | (0.02) | (0.02) | (0.01) | (0.03) | (0.02) | ||
| Aid / GDP (log) | 0.00 | -0.03 | -0.01 | -0.00 | -0.02 | -0.01 | -0.00 | -0.00 | |
| (0.08) | (0.05) | (0.04) | (0.07) | (0.07) | (0.06) | (0.06) | (0.06) | ||
| GDP p/c | -0.35** | -0.40*** | -0.42*** | -0.37*** | -0.39** | -0.37*** | -0.36*** | -0.36*** | |
| (0.12) | (0.10) | (0.08) | (0.11) | (0.12) | (0.11) | (0.11) | (0.11) | ||
| Population | 0.08 | 0.07 | 0.07 | 0.06 | 0.04 | 0.06 | 0.06 | 0.06 | |
| (0.10) | (0.08) | (0.05) | (0.09) | (0.09) | (0.09) | (0.09) | (0.09) | ||
| Conflict Intensity | 0.16 | 0.25 | 0.22 | 0.11 | 0.11 | 0.10 | 0.11 | 0.11 | |
| (0.22) | (0.21) | (0.17) | (0.22) | (0.21) | (0.22) | (0.22) | (0.22) | ||
| Non-State Violence | -1.05* | -0.68** | -0.88*** | -0.91* | -0.89* | -0.92* | -0.92* | -0.90* | |
| (0.44) | (0.22) | (0.27) | (0.40) | (0.41) | (0.40) | (0.40) | (0.41) | ||
| Nat. Res. Rents | -0.01 | -0.01* | -0.01+ | -0.00 | -0.00 | -0.00 | -0.00 | -0.00 | |
| (0.01) | (0.00) | (0.00) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | ||
| Regime Type (FH) | 0.39*** | 0.33*** | 0.33*** | 0.40*** | 0.40*** | 0.40*** | 0.39*** | 0.39*** | |
| (0.08) | (0.07) | (0.06) | (0.08) | (0.08) | (0.08) | (0.08) | (0.08) | ||
| Time | -0.37 | ||||||||
| (0.26) | |||||||||
| Time\(^2\) | 0.11 | ||||||||
| (0.09) | |||||||||
| Time\(^3\) | -0.01 | ||||||||
| (0.01) | |||||||||
| Num. obs. | 251 | 260 | 197 | 273 | 273 | 273 | 273 | 273 | |
| Countries | 45 | 45 | 45 | 46 | 46 | 46 | 46 | 46 | |
| Adj. R2 | 0.38 | 0.35 | 0.48 | 0.35 | 0.32 | 0.36 | 0.35 | 0.35 | |
| ***p < 0.001, **p < 0.01, *p < 0.05, +p < 0.1 | |||||||||