# 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_spending <- ggplot(diss_df, aes(x = cabinetINClabel, y = v2dlencmps_t1)) +
geom_jitter(size = 1.7, 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 = "Particularistic vs. Public Spending")
plot_allaid_spending <- ggplot(diss_df,
aes(x = log(aiddata_AidGDP),
y = v2dlencmps_t1)) +
geom_point(alpha = 0.5, size = 1.7) +
geom_smooth(method = "lm") +
theme_bw() +
labs(x = "All Aid / GDP (log)",
y = "Particularistic. vs. Public Spending")
# Output for Manuscript
# options( tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/aid_ps_individ_spending.tex", height = 3.5)
# gridExtra::grid.arrange(plot_ps_spending, plot_allaid_spending, nrow = 1)
# dev.off()
# Output for Rep. Archive
gridExtra::grid.arrange(plot_ps_spending, plot_allaid_spending, nrow = 1)

# 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")
# generate plot
plot_aidps_spending <- ggplot(diss_df,
aes(x = log(aiddata_AidGDP),
y = v2dlencmps_t1)) +
geom_point(alpha = 0.5) +
geom_smooth(method = "lm") +
facet_wrap(~ cabinetINClabel) +
theme_bw() +
labs(x = "All Aid / GDP (log)",
y = "Particularistic. vs. Public Spending")
# Output for Manuscript
# options( tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/aidps_spending_plot.tex", height = 3.5)
# print(plot_aidps_spending)
# dev.off()
# Output for Rep. Archive
print(plot_aidps_spending)

# Libraries
library(tidyverse)
library(cowplot)
library(lfe)
library(tikzDevice)
# Data
load("./data/diss_df.rda")
diss_df <- diss_df %>%
dplyr::select(-matches("logit"))
# Prepare data frame for multiple plots
spending_vars <- list(
v2dlencmps_t1 = diss_df,
v2dlencmps_t2 = diss_df,
v2dlencmps_t3 = diss_df,
v2dlencmps_t4 = diss_df,
v2dlencmps_t5 = diss_df,
v2x_corr_t1 = diss_df,
v2x_corr_t2 = diss_df,
v2x_corr_t3 = diss_df,
v2x_corr_t4 = diss_df,
v2x_corr_t5 = diss_df
)
# create data frame with list column
spending_vars <- enframe(spending_vars)
# define function that will be applied to every data frame in the list column
main_model <- function(lead_type, data) {
data <- as.data.frame(data)
data$lead_var <- data[, grep(lead_type, names(data), value =T)]
model <- lfe::felm(lead_var ~
cabinetCOUNT *
aiddata_AidGDP_ln +
log(GDP_per_capita) +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh | 0 | 0 | GWNo,
data=data)
return(model)
}
# fit models & post-process data for plotting
model_all <- spending_vars %>%
dplyr::mutate(model = map2(name, value, ~ main_model(.x, .y)))
model_out <- model_all %>%
mutate(coef = map(model, broom::tidy)) %>%
unnest(coef) %>%
# keep only interaction term coefs
filter(term == "cabinetCOUNT:aiddata_AidGDP_ln") %>%
mutate(dem_score = ifelse(grepl("v2dlencmps", name), "Public vs. Particularistic Spending", "Political Corruption")) %>%
dplyr::select(dem_score, name, estimate, std.error) %>%
group_by(dem_score) %>%
mutate(name = 1:5)
temp_dyn_pubgoods <- model_out
save(temp_dyn_pubgoods, file = "./data/temp_dyn_pubgoods.rda")
temp_dynamics_plot <- ggplot(model_out,
aes(x = name,
y = estimate,
group = dem_score, color = dem_score)) +
geom_point( aes(group = dem_score), size = 1.7,
position = position_dodge(width = .5)) +
geom_errorbar(aes(ymin = estimate - 1.67 * std.error,
ymax = estimate + 1.67 * std.error,
linetype = dem_score),
width = 0,
position = position_dodge(width = .5)) +
geom_hline(yintercept = 0, linetype = 2) +
scale_color_manual("", values = c("#4575b4", "#e41a1c")) +
scale_linetype_manual("", values = c(1, 5)) +
theme_bw()+
labs(x = "Year after t0", y = "Estimate of Interaction Coefficient \n between Power-Sharing (cabinet)\n and Aid/GDP (log)") +
theme(legend.position = "bottom") +
theme(legend.key.size=unit(3,"lines")) # +
# annotate("rect", xmin=1.5, xmax=2.5, ymin=-Inf, ymax=Inf, alpha=.1, fill="blue")
# Output for manuscript
# options(tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/temp_dynamics_plot_spending.tex", height = 3.5)
# print(temp_dynamics_plot)
# dev.off()
# Output for replication archive
print(temp_dynamics_plot)

# Libraries
library(tidyverse)
library(rms)
library(gridExtra)
library(tikzDevice)
# Load data
load("data/diss_df.rda")
# Estimate Models
# binary PS
model_aidps_spending_cabINC <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data=diss_df, x=T, y=T)
model_aidps_spending_cabINC <- rms::robcov(model_aidps_spending_cabINC, diss_df$GWNo)
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)
# Generate ME plots
source("functions/interaction_plots.R")
#
# # Output for manuscript
# options(tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/interaction_spending.tex", height = 3.5)
#
#
# par(mfrow=c(1,3),
# mar = c(5, 7, 4, 0.5),
# cex.lab = 1.3,
# cex.axis = 1.3,
# mgp = c(3.5, 1, 0))
#
# interaction_plot_continuous(model_aidps_spending,
# "cabinetCOUNT",
# "aiddata_AidGDP_ln",
# "cabinetCOUNT * aiddata_AidGDP_ln",
# title = "",
# ylab = "Marginal effect of Power-Sharing (cabinet) \n on Public vs. Particularistic Spending",
# add_median_effect = T,
# xlab = "a) Aid / GDP (Log)\n",
# conf = .90)
# interaction_plot_continuous(model_aidps_spending,
# "aiddata_AidGDP_ln",
# "cabinetCOUNT",
# "cabinetCOUNT * aiddata_AidGDP_ln",
# title = "",
# add_median_effect = T,
# ylab = "Marginal effect of Aid\n on Public vs. Particularistic Spending",
# xlab = "b) Power-Sharing \n(Number of rebel seats)",
# conf = .90)
# interaction_plot_binary(model_aidps_spending_cabINC,
# "aiddata_AidGDP_ln",
# "cabinetINC",
# "cabinetINC * aiddata_AidGDP_ln",
# title = "",
# ylab = "Marginal effect of Aid\n on Public vs. Particularistic Spending",
# xlab = "c) Power-Sharing \n(1 = Yes, 0 = No)",
# conf = .90)
#
# dev.off()
# Output for Replication Archive
par(mfrow=c(1,3),
mar = c(5, 7, 4, 0.5),
cex.lab = 1.3,
cex.axis = 1.3,
mgp = c(3.5, 1, 0))
interaction_plot_continuous(model_aidps_spending,
"cabinetCOUNT",
"aiddata_AidGDP_ln",
"cabinetCOUNT * aiddata_AidGDP_ln",
title = "",
ylab = "Marginal effect of Power-Sharing (cabinet) \n on Public vs. Particularistic Spending",
add_median_effect = T,
xlab = "a) Aid / GDP (Log)\n",
conf = .90)
interaction_plot_continuous(model_aidps_spending,
"aiddata_AidGDP_ln",
"cabinetCOUNT",
"cabinetCOUNT * aiddata_AidGDP_ln",
title = "",
add_median_effect = T,
ylab = "Marginal effect of Aid\n on Public vs. Particularistic Spending",
xlab = "b) Power-Sharing \n(Number of rebel seats)",
conf = .90)
interaction_plot_binary(model_aidps_spending_cabINC,
"aiddata_AidGDP_ln",
"cabinetINC",
"cabinetINC * aiddata_AidGDP_ln",
title = "",
ylab = "Marginal effect of Aid\n on Public vs. Particularistic Spending",
xlab = "c) Power-Sharing \n(1 = Yes, 0 = No)",
conf = .90)

# Libraries
library(tidyverse)
library(cowplot)
library(lfe)
library(tikzDevice)
# Data
load("./data/diss_df.rda")
diss_df <- diss_df %>%
dplyr::select(-matches("logit")) %>%
mutate(dga_gdp_ln = log(dga_gdp_zero +1 ),
pga_gdp_ln = log(program_aid_gdp_zero + 1),
bga_gdp_ln = log(commodity_aid_gdp_zero + 1))
# Prepare data frame for multiple plots
spending_vars <- list(
cabinetCOUNT = diss_df,
seniorCOUNT = diss_df,
nonseniorCOUNT = diss_df,
dga_gdp_ln = diss_df,
pga_gdp_ln = diss_df,
bga_gdp_ln = diss_df
)
# create data frame with list column
spending_vars <- enframe(spending_vars)
# define function that will be applied to every data frame in the list column
main_model <- function(ind_var, data) {
data <- as.data.frame(data)
data$ind_var <- data[, ind_var]
if(grepl("COUNT", ind_var)) {
model <- lfe::felm(v2dlencmps_t1 ~
ind_var *
aiddata_AidGDP_ln +
log(GDP_per_capita) +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh | 0 | 0 | GWNo,
data=data)
return(model)
} else {
model <- lfe::felm(v2dlencmps_t1 ~
cabinetCOUNT *
ind_var +
log(GDP_per_capita) +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh | 0 | 0 | GWNo,
data=data)
return(model)
}
}
# fit models & post-process data for plotting
model_all <- spending_vars %>%
dplyr::mutate(model = map2(name, value, ~ main_model(.x, .y)))
model_out <- model_all %>%
mutate(coef = map(model, broom::tidy)) %>%
unnest(coef) %>%
# keep only interaction term coefs
filter(grepl(":", term)) %>%
dplyr::select(name, estimate, std.error) %>%
mutate(name = forcats::fct_relevel(name,
c("cabinetCOUNT",
"seniorCOUNT",
"nonseniorCOUNT",
"dga_gdp_ln",
"pga_gdp_ln",
"bga_gdp_ln")))
model_out_pubgoods <- model_out
save(model_out_pubgoods, file= "./data/mechanism_models_pubgoods.rda")
mechanisms_spending_plot <- ggplot(model_out,
aes(x = name,
y = estimate)) +
geom_point( size = 1.7,
position = position_dodge(width = .5)) +
geom_errorbar(aes(ymin = estimate - 1.67 * std.error,
ymax = estimate + 1.67 * std.error),
width = 0,
position = position_dodge(width = .5)) +
geom_hline(yintercept = 0, linetype = 2) +
theme_bw()+
scale_x_discrete(labels = c("Cabinet PS (Baseline)",
"Senior PS",
"Nonsenior PS",
"DGA",
"Program Aid",
"Budget Aid")) +
labs(x = "", y = "Estimate of Interaction Coefficient \n between Different Types of \n Power-Sharing (cabinet) and Aid")
# Output for manuscript
# options(tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/mechanisms_spending_plot.tex", height = 2.75)
# print(mechanisms_spending_plot)
# dev.off()
# Output for replication archive
print(mechanisms_spending_plot)

# Libraries
library(tidyverse)
library(rms)
library(gridExtra)
library(tikzDevice)
# Load data
load("data/diss_df.rda")
diss_df <- diss_df %>%
dplyr::select(-matches("logit")) %>%
mutate(dga_gdp_ln = log(dga_gdp_zero +1 ),
pga_gdp_ln = log(program_aid_gdp_zero + 1),
bga_gdp_ln = log(commodity_aid_gdp_zero + 1))
# 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 *
bga_gdp_ln +
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
bga_gdp_ln = seq(-8, 4.9, 0.1),# range of aid
conf.int = 0.9)
subs_effects_spending_aid <- ggplot(data.frame(prediction_democ_aid),
aes(x = exp(bga_gdp_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 = "Budget Aid / GDP",
y = "Predicted Public vs. \nParticularistic Spending Scores") +
theme(legend.position = "bottom")
# Predictions power-sharing
prediction_democ_ps <- Predict(model_aidps_spending,
cabinetCOUNT = seq(0, 10, 1),
bga_gdp_ln = c(0, 3.4),
conf.int = 0.9)
prediction_democ_ps$bga_gdp_ln <- round(exp(prediction_democ_ps$bga_gdp_ln))
subs_effects_spending_ps <- ggplot(data.frame(prediction_democ_ps),
aes(x = cabinetCOUNT,
y = yhat,
group = as.factor(exp(bga_gdp_ln)))) +
geom_line( color = "black", size = 1) +
geom_ribbon(aes(ymax = upper,
ymin = lower,
fill = as.factor(bga_gdp_ln)),
alpha = 0.7) +
scale_fill_manual(values = c("#b3cde3", "#e41a1c"),
name = "Budget 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. \nParticularistic Spending Scores") +
theme(legend.position = "bottom")
# output prediction plots
# output plot for predicted VDEM election quality variables
# options( tikzDocumentDeclaration = "\\documentclass[11pt]{article}" )
# tikz("../figures/budget_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)

# Libraries
library(texreg)
source("functions/extract_ols_custom.R")
library(rms)
# load Data
load("./data/diss_df.rda")
# Power-Sharing Models
model_ps_spending_cabcount <- 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_ps_spending_cabcount <- rms::robcov(model_ps_spending_cabcount, diss_df$GWNo)
model_ps_spending_seniorcount <- ols(v2dlencmps_t1 ~
seniorCOUNT +
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data=diss_df, x=T, y=T)
model_ps_spending_seniorcount <- rms::robcov(model_ps_spending_seniorcount, diss_df$GWNo)
model_ps_spending_nonseniorcount <- ols(v2dlencmps_t1 ~
nonseniorCOUNT +
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data=diss_df, x=T, y=T)
model_ps_spending_nonseniorcount <- rms::robcov(model_ps_spending_nonseniorcount, diss_df$GWNo)
# Aid Models
model_dga_spending <- ols(v2dlencmps_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_spending <- rms::robcov(model_dga_spending, diss_df$GWNo)
model_pga_spending <- ols(v2dlencmps_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_spending <- rms::robcov(model_pga_spending, diss_df$GWNo)
model_bga_spending <- ols(v2dlencmps_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_spending <- rms::robcov(model_bga_spending, diss_df$GWNo)
model_list <- list(model_ps_spending_cabcount,
model_ps_spending_seniorcount,
model_ps_spending_nonseniorcount,
model_dga_spending,
model_pga_spending,
model_bga_spending)
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")
# Get number of clusters
source("./functions/extract_ols_custom.R")
# 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_pubgoods.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.01 | 0.01 | 0.01 | 0.01 | |||
| (0.04) | (0.04) | (0.03) | (0.04) | ||||
| Power-Sharing (senior) | 0.01 | ||||||
| (0.09) | |||||||
| Power-Sharing (nonsenior) | 0.01 | ||||||
| (0.05) | |||||||
| DGA/GDP (log) | -0.05 | ||||||
| (0.18) | |||||||
| Program Aid/GDP (log) | 0.21 | ||||||
| (0.16) | |||||||
| Budget Aid/GDP (log) | 0.16 | ||||||
| (0.11) | |||||||
| Aid / GDP (log) | -0.00 | -0.00 | -0.00 | 0.00 | -0.06 | -0.05 | |
| (0.06) | (0.06) | (0.06) | (0.06) | (0.06) | (0.06) | ||
| GDP p/c (log) | -0.34** | -0.34** | -0.34** | -0.35** | -0.28* | -0.33** | |
| (0.11) | (0.11) | (0.11) | (0.11) | (0.14) | (0.11) | ||
| Population (log) | 0.06 | 0.06 | 0.06 | 0.06 | 0.08 | 0.06 | |
| (0.09) | (0.09) | (0.09) | (0.09) | (0.09) | (0.09) | ||
| Conflict Intensity | 0.07 | 0.07 | 0.07 | 0.09 | 0.05 | 0.03 | |
| (0.22) | (0.22) | (0.22) | (0.23) | (0.22) | (0.22) | ||
| Non-State Violence | -0.93* | -0.93* | -0.93* | -0.95* | -0.91* | -0.88* | |
| (0.40) | (0.40) | (0.40) | (0.40) | (0.40) | (0.38) | ||
| Nat. Res. Rents | -0.00 | -0.00 | -0.00 | -0.00 | -0.00 | -0.00 | |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | ||
| Regime Type (FH) | 0.38*** | 0.38*** | 0.38*** | 0.39*** | 0.38*** | 0.37*** | |
| (0.08) | (0.08) | (0.08) | (0.08) | (0.08) | (0.08) | ||
| Num. obs. | 273 | 273 | 273 | 273 | 273 | 273 | |
| Countries | 46 | 46 | 46 | 46 | 46 | 46 | |
| Adj. R2 | 0.34 | 0.34 | 0.34 | 0.34 | 0.35 | 0.35 | |
| ***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
load("./data/diss_df.rda")
# binary PS
model_aidps_spending_cabINC <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data=diss_df, x=T, y=T)
model_aidps_spending_cabINC <- rms::robcov(model_aidps_spending_cabINC, diss_df$GWNo)
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)
model_aidps_corr_cabinc <- ols(v2x_corr_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
log(WBnatres + 1) +
fh,
data=diss_df, x=T, y=T)
model_aidps_corr_cabinc <- rms::robcov(model_aidps_corr_cabinc, diss_df$GWNo)
model_aidps_corr <- ols(v2x_corr_t1 ~
cabinetCOUNT *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
log(WBnatres + 1) +
fh,
data=diss_df, x=T, y=T)
model_aidps_corr <- rms::robcov(model_aidps_corr, diss_df$GWNo)
model_list <- list(model_aidps_spending_cabINC,
model_aidps_spending,
model_aidps_corr_cabinc,
model_aidps_corr)
coef_name_map <- list(
cabinetINC = "Power-Sharing (binary)",
"cabinetINC * aiddata_AidGDP_ln" = "Power-Sharing (binary) * Aid",
cabinetCOUNT = "Power-Sharing (cabinet)",
"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/extract_ols_custom.R")
source("./functions/custom_texreg.R")
environment(custom_texreg) <- asNamespace('texreg')
#
# custom_texreg(model_list,
# stars = c(0.001, 0.01, 0.05, 0.1),
# custom.coef.map = coef_name_map,
# symbol = "+",
# file = "../output/psaid_pubgoods.tex",
# table = F,
# booktabs = T,
# use.packages = F,
# dcolumn = T,
# custom.multicol = T,
# custom.model.names = c(" \\multicolumn{2}{c}{ \\textbf{Public vs. Particularistic Spending}} & \\multicolumn{2}{c}{ \\textbf{Political Corruption}} \\\\ \\cmidrule(r){2-3} \\cmidrule(l){4-5} & \\multicolumn{1}{c}{(1) }",
# "\\multicolumn{1}{c}{(2) }",
# "\\multicolumn{1}{c}{(3) }",
# "\\multicolumn{1}{c}{(4) }"),
# include.cluster = T,
# include.rsquared = F,
# star.symbol = "\\*",
# include.lr = F)
texreg::htmlreg(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.cluster = T,
include.rsquared = F,
star.symbol = "\\*",
include.lr = F,
caption = "")
| Model 1 | Model 2 | Model 3 | Model 4 | ||
|---|---|---|---|---|---|
| Power-Sharing (binary) | 0.92** | 0.03 | |||
| (0.29) | (0.06) | ||||
| Power-Sharing (binary) * Aid | -0.28* | -0.01 | |||
| (0.13) | (0.02) | ||||
| Power-Sharing (cabinet) | 0.12+ | 0.01 | |||
| (0.07) | (0.01) | ||||
| Power-Sharing (cabinet) * Aid | -0.04* | -0.00 | |||
| (0.02) | (0.00) | ||||
| Aid / GDP (log) | -0.02 | -0.00 | -0.00 | -0.00 | |
| (0.06) | (0.06) | (0.01) | (0.01) | ||
| GDP p/c (log) | -0.38*** | -0.37*** | -0.03 | -0.03 | |
| (0.10) | (0.11) | (0.02) | (0.02) | ||
| Population (log) | 0.06 | 0.06 | 0.02 | 0.02 | |
| (0.09) | (0.09) | (0.01) | (0.01) | ||
| Conflict Intensity | 0.13 | 0.11 | -0.04 | -0.04 | |
| (0.22) | (0.22) | (0.04) | (0.04) | ||
| Non-State Violence | -0.93* | -0.90* | 0.04 | 0.04 | |
| (0.40) | (0.41) | (0.03) | (0.03) | ||
| Nat. Res. Rents | -0.00 | -0.00 | 0.01 | 0.01 | |
| (0.01) | (0.01) | (0.01) | (0.01) | ||
| Regime Type (FH) | 0.40*** | 0.39*** | -0.06*** | -0.06*** | |
| (0.08) | (0.08) | (0.01) | (0.01) | ||
| Num. obs. | 273 | 273 | 273 | 273 | |
| Countries | 46 | 46 | 46 | 46 | |
| Adj. R2 | 0.37 | 0.35 | 0.42 | 0.42 | |
| ***p < 0.001, **p < 0.01, *p < 0.05, +p < 0.1 | |||||
# Libraries
library(texreg)
source("functions/extract_ols_custom.R")
source("./functions/extract_plm_custom.R")
library(rms)
library(countrycode)
# load Data
load("./data/diss_df.rda")
model_aidps_spending_ethnic <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh +
Ethnic,
data=diss_df, x=T, y=T)
model_aidps_spending_ethnic <- rms::robcov(model_aidps_spending_ethnic, diss_df$GWNo)
model_aidps_spending_pko <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh +
DS_ordinal,
data=diss_df, x=T, y=T)
model_aidps_spending_pko <- rms::robcov(model_aidps_spending_pko, diss_df$GWNo)
# Cabinet Share
library(readxl)
cnts <- read_excel("./data/CNTSDATA.xls")
cnts <- cnts %>% filter(year >= 1989)
cnts$iso3c <- countrycode(cnts$country, "country.name", "iso3c")
cnts <- cnts %>% filter(country != "SOMALILAND")
testcabsize <- left_join(diss_df, cnts[, c("iso3c", "year", "polit10")])
testcabsize$ps_share <- testcabsize$cabinetINC / testcabsize$polit10 * 100
model_cabsize_spending <- ols(v2dlencmps_t1 ~
ps_share *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data = testcabsize, x = T, y = T)
model_cabsize_spending <- robcov(model_cabsize_spending, testcabsize$GWNo)
# personalist politics
personalist <- read_excel("./data/autoregime5.xls") %>%
dplyr::select(cowcode, year, persagg1ny, persaggny2)
diss_df <- left_join(diss_df, personalist,
by = c("GWNo" = "cowcode", "year"))
model_aidps_spending_personalist <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh +
persaggny2,
data=diss_df, x=T, y=T)
model_aidps_spending_personalist <- rms::robcov(model_aidps_spending_personalist,
diss_df$GWNo)
# Random Effects
library(plm)
model_aidps_spending_re <- plm(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh,
data=diss_df, x=T, y=T,
model = "random",
index = c("GWNo", "year"))
series conflictID is NA and has been removed series conflictdummy, xnewconflictinyearv412, xonset1v412, xonset2v412, xonset5v412, xonset8v412, xonset20v412, xmaxintyearv412, xgovonlyv412, xterronlyv412, xbothgovterrv412, xsumconfv412, xpcyears, xis.pc, xcodingend are constants and have been removed
model_aidps_spending_re$vcov <- plm::vcovHC(model_aidps_spending_re)
# Region Fixed Effects
diss_df$regionFE <- countrycode(diss_df$Location, "country.name", "region")
diss_df$yearFE <- as.factor(diss_df$year)
model_aidps_spending_regionFE <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh +
regionFE ,
data=diss_df, x=T, y=T)
model_aidps_spending_regionFE <- rms::robcov(model_aidps_spending_regionFE,
diss_df$GWNo)
# model_aidps_spending_cntryFE <- lfe::felm(v2dlencmps_t1 ~
# cabinetINC *
# log(commodity_aid_gdp + 1) +
# aiddata_AidGDP_ln +
# ln_gdp_pc +
# ln_pop +
# conf_intens +
# nonstate +
# WBnatres +
# fh | GWNo | 0 | GWNo,
# data=diss_df, exactDOF = T)
model_list <- list(model_aidps_spending_ethnic,
model_aidps_spending_pko,
model_cabsize_spending,
model_aidps_spending_personalist,
model_aidps_spending_re,
model_aidps_spending_regionFE)
## Order of coefficients in output table
name_map_robustness <- list(cabinetINC = "Power-Sharing (binary)",
"cabinetINC * aiddata_AidGDP_ln" = "PS (binary) * Aid",
"cabinetINC:aiddata_AidGDP_ln" = "PS (binary) * Aid",
ps_share = "PS (cabinet share)",
"ps_share * aiddata_AidGDP_ln" = "PS (cabinet share) * Aid",
aiddata_AidGDP_ln = "Aid / GDP (log)",
ln_gdp_pc = "GDP p/c",
ln_pop = "Population",
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",
persaggny2 = "Personalism Index",
spending_regional_mean = "Part. Spending Regional Mean",
commonlaw = "Common Law",
duration_constitution = "Const. Duration")
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),
# symbol = "+",
# table = F,
# booktabs = T,
# use.packages = F,
# dcolumn = T,
# custom.coef.map = name_map_robustness,
# file = "../output/aidps_spending_robustness.tex",
# custom.model.names = c("(1) ELF",
# "(2) PKO",
# "(3) Cab. Size",
# "(4) Personalist Politics",
# "(5) RE",
# "(6) Region FE"),
#
# star.symbol = "\\*",
# include.lr = F,
# include.cluster = T,
# include.rsquared = F,
# include.variance = F)
# Output Replication Archive
htmlreg(l = model_list,
stars = c(0.001, 0.01, 0.05, 0.1),
symbol = "+",
table = F,
booktabs = T,
use.packages = F,
dcolumn = T,
custom.coef.map = name_map_robustness,
# file = "../output/aidps_spending_robustness.tex",
custom.model.names = c("(1) ELF",
"(2) PKO",
"(3) Cab. Size",
"(4) Personalist Politics",
"(5) RE",
"(6) Region FE"),
star.symbol = "\\*",
include.lr = F,
include.cluster = T,
include.rsquared = F,
include.variance = F)
| (1) ELF | (2) PKO | (3) Cab. Size | (4) Personalist Politics | (5) RE | (6) Region FE | ||
|---|---|---|---|---|---|---|---|
| Power-Sharing (binary) | 0.89** | 0.94*** | 0.95** | 0.19+ | 0.44 | ||
| (0.31) | (0.25) | (0.29) | (0.10) | (0.31) | |||
| PS (binary) * Aid | -0.28* | -0.26* | -0.30* | -0.10* | -0.20+ | ||
| (0.13) | (0.12) | (0.14) | (0.05) | (0.11) | |||
| PS (cabinet share) | 0.27*** | ||||||
| (0.07) | |||||||
| PS (cabinet share) * Aid | -0.10*** | ||||||
| (0.02) | |||||||
| Aid / GDP (log) | -0.01 | -0.01 | 0.01 | -0.01 | 0.04 | 0.01 | |
| (0.06) | (0.06) | (0.07) | (0.06) | (0.03) | (0.06) | ||
| GDP p/c | -0.38*** | -0.38*** | -0.38*** | -0.37*** | 0.05 | -0.12 | |
| (0.10) | (0.10) | (0.10) | (0.11) | (0.27) | (0.13) | ||
| Population | 0.06 | 0.06 | 0.03 | 0.07 | 0.04 | 0.01 | |
| (0.09) | (0.09) | (0.10) | (0.08) | (0.10) | (0.08) | ||
| Conflict Intensity | 0.12 | 0.19 | 0.18 | 0.13 | -0.00 | 0.16 | |
| (0.20) | (0.21) | (0.24) | (0.21) | (0.08) | (0.19) | ||
| Non-State Violence | -0.95* | -0.94* | -0.92** | -0.95* | -0.24* | -0.96* | |
| (0.39) | (0.41) | (0.35) | (0.39) | (0.11) | (0.39) | ||
| Nat. Res. Rents | -0.00 | -0.00 | -0.00 | -0.00 | -0.01+ | 0.00 | |
| (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | (0.01) | ||
| Regime Type (FH) | 0.40*** | 0.39*** | 0.37*** | 0.39*** | 0.13*** | 0.38*** | |
| (0.08) | (0.08) | (0.09) | (0.08) | (0.03) | (0.08) | ||
| Ethnic Frac. | 0.18 | ||||||
| (0.57) | |||||||
| UN PKO | -0.09 | ||||||
| (0.06) | |||||||
| Personalism Index | 0.39 | ||||||
| (0.54) | |||||||
| Num. obs. | 273 | 273 | 214 | 273 | 273 | 273 | |
| Countries | 46 | 46 | 42 | 46 | 46 | 46 | |
| Adj. R2 | 0.37 | 0.38 | 0.32 | 0.37 | 0.19 | 0.48 | |
| ***p < 0.001, **p < 0.01, *p < 0.05, +p < 0.1 | |||||||
# Libraries
library(texreg)
source("functions/extract_ols_custom.R")
library(rms)
library(countrycode)
# load Data
load("./data/diss_df.rda")
# 1. Matching -------------------------------------------------------------
library(MatchIt)
library(tidyr)
# prepare data without missings
match_spend_data <- diss_df %>%
ungroup() %>%
dplyr::select(cabinetINC, cabinetCOUNT, seniorINC,
seniorCOUNT, nonseniorINC, nonseniorCOUNT,
aiddata_AidGDP, population, nonstate,
WBnatres, fh, GDP_per_capita, conf_intens,
aiddata_AidGDP_ln, GWNo, year,
# commodity_aid_gdp_ln,
pc_period, Location, ln_pop, ln_gdp_pc,
v2dlencmps_t1, v2x_corr_t1)
match_spend_data <- match_spend_data[complete.cases(match_spend_data), ]
# generate pretreatment controls
match_spend_data <- match_spend_data %>%
arrange(GWNo, pc_period, year) %>%
group_by(GWNo, pc_period) %>%
mutate(match_aiddata_AidGDP_ln = first(aiddata_AidGDP_ln),
match_pop = first(population),
match_gdp = first(GDP_per_capita),
match_nonstate = first(nonstate),
match_WBnatres = first(WBnatres),
match_fh = first(fh))
# convert back to data frame
match_spend_data <- as.data.frame(match_spend_data)
# 1.1 Perform Matching ----------------------------------------------------
set.seed(123)
# perform matching algorithm
match_spend_res <- matchit(cabinetINC ~
match_aiddata_AidGDP_ln +
log(match_gdp) +
log(match_pop) +
conf_intens + # conf_intens is already pre-treatment
match_nonstate +
log(match_WBnatres + 1) +
match_fh ,
method = "nearest",
ratio = 2,
distance = "mahalanobis",
data = match_spend_data)
# extract data
match_spend_df <- match.data(match_spend_res)
# 1.3 Reestimate on matched sample ----------------------------------------
# all
model_spend_matched <- ols(v2dlencmps_t1 ~
cabinetINC *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh
,
data=match_spend_df , x=T, y=T)
model_spend_matched <- rms::robcov(model_spend_matched, match_spend_df$GWNo)
# cabinetCOUNT
model_spend_matchedCOUNT <- ols(v2dlencmps_t1 ~
cabinetCOUNT *
aiddata_AidGDP_ln +
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh
,
data=match_spend_df , x=T, y=T)
model_spend_matchedCOUNT <- rms::robcov(model_spend_matchedCOUNT, match_spend_df$GWNo)
# 2. Instrumental Variables -----------------------------------------------
# 2.1 Data Preparation ----------------------------------------------------
# load libraries
library(AER)
library(ivpack)
library(lmtest)
# load data with instrument; this gives "instrument_df" data frame
load(file = "./data/instrumentedAid2.RData")
diss_df_iv <- merge(diss_df,
instrument_df,
by = c("iso2c", "year"), all.x = TRUE)
# subset only complete.cases / necessary for cluster.robust.se()
iv_na <- na.omit(diss_df_iv[, c("cabinetCOUNT",
"cabinetINC",
"aiddata_Aid",
"aiddata_AidGDP_ln",
"fh",
"GDP_per_capita",
"population",
"conf_intens",
"WBnatres",
"total_sum_except",
"year",
"GWNo",
"GDP",
"nonstate",
"v2dlencmps_t1",
"v2x_corr_t1")])
# 2.2 Reduced Form ---------------------------------------------------------
# # reduced form:
# reduced_form_spending <- ols(v2dlencmps_t1 ~
# cabinetINC *
# log(total_sum_except / GDP) +
# log(dga_gdp + 0.001) +
# log(program_aid_gdp + + 0.001) +
# log(GDP_per_capita) +
# log(population) +
# conf_intens +
# nonstate +
# fh,
# data=iv_na, x=T, y=T)
# reduced_form_spending <- robcov(reduced_form_spending, iv_na$GWNo)
#
#
# reduced_form_corr <- ols(v2x_corr_t1 ~
# cabinetCOUNT *
# log(total_sum_except / GDP) +
# log(GDP_per_capita) +
# log(population) +
# conf_intens +
# nonstate +
# fh +
# polity2,
# data=iv_na, x=T, y=T)
# reduced_form_corr <- robcov(reduced_form_corr , iv_na$GWNo)
# 2.3 IV Analysis -------------------------------------------------------------
# to proceed with IV estimation I first hard-code the instrument
iv_na$instr_aid_gdp_ln <- log(iv_na$total_sum_except / iv_na$GDP)
# data transformation for Stata
iv_na$ln_gdp_pc <- log(iv_na$GDP_per_capita)
iv_na$ln_pop <- log(iv_na$population)
# iv_na$dga_gdp_ln <- log(iv_na$dga_gdp + 0.01)
# iv_na$program_aid_gdp_ln <- log(iv_na$program_aid_gdp + 0.01)
# and save data to Stata format
foreign::write.dta(iv_na, "./data/iv_na_spending.dta")
# hard code interaction variable
iv_na$cabincXaid <- iv_na$aiddata_AidGDP_ln * iv_na$cabinetINC
iv_na$cabincXaid_instr <- iv_na$instr_aid_gdp_ln * iv_na$cabinetINC
library(lfe)
iv_spending <- felm(v2dlencmps_t1 ~
cabinetINC + # outcome equation / 2nd stage regression
ln_gdp_pc +
ln_pop +
conf_intens +
nonstate +
WBnatres +
fh
| 0 | (aiddata_AidGDP_ln|cabincXaid ~
instr_aid_gdp_ln + cabincXaid_instr) | GWNo,
data = iv_na)
# Output
model_list <- list(model_spend_matched,
iv_spending)
## Order of coefficients in output table
name_map_robustness <- list(cabinetINC = "Power-Sharing (binary)",
"cabinetINC * aiddata_AidGDP_ln" = "Power-Sharing (binary) * Aid",
"`cabincXaid(fit)`" = "Power-Sharing (binary) * Aid",
"`aiddata_AidGDP_ln(fit)`" = "Aid / GDP (log)",
"aiddata_AidGDP_ln" = "Aid / GDP (log)",
"ln_gdp_pc" = "GDP p/c",
"ln_pop" = "Population",
conf_intens = "Conflict Intensity",
nonstate = "Non-State Violence",
WBnatres = "Nat. Res. Rents",
polity2 = "Regime Type",
fh = "Regime Type")
source("./functions/custom_texreg.R")
environment(custom_texreg) <- asNamespace('texreg')
source("./functions/custom_texreg.R")
environment(custom_texreg) <- asNamespace('texreg')
source("functions/extract_felm_custom.R")
# # Output Manuscript
# custom_texreg(l = model_list,
# stars = c(0.001, 0.01, 0.05, 0.1),
# symbol = "+",
# table = F,
# booktabs = T,
# use.packages = F,
# dcolumn = T,
# custom.coef.map = name_map_robustness,
# file = "../output/aidps_spending_endogeneity.tex",
# custom.model.names = c("(1) Matching",
# "(2) 2SLS"),
#
# star.symbol = "\\*",
# include.lr = F,
# include.cluster = F,
# add.lines = list(c("Countries",
# length(unique(match_spend_df$GWNo)),
# length(unique(diss_df$GWNo))),
# c("Kleibergen-Paap rk Wald F statistic",
# "",
# "43.11")),
# include.rsquared = F,
# include.variance = F)
use "./data/iv_na_spending.dta", clear
* Generate interactions & interactions with instrument
gen cabXaid = cabinetINC * aiddata_AidGDP_ln
gen cabXaid_instr = cabinetINC * instr_aid_gdp_ln
ivreg2 v2dlencmps_t1 cabinetINC ln_gdp_pc ln_pop nonstate conf_intens WBnatres fh ///
(aiddata_AidGDP_ln cabXaid = instr_aid_gdp_ln cabXaid_instr), cluster(GWNo) first