This is the replication archive for the dissertation
“Buying Democracy? The Political Economy of Foreign Aid, Power-Sharing Cabinets, and Post-Conflict Political Development”
by Felix Haass. This archive contains all the R
and Stata
code necessary to replicate the figures and tables in my dissertation.
There are two basic ways to replicate the analyses in this dissertation: replication of a chapter or replication of individual tables/figures.
At the top of each page, in the upper right corner, you’ll find a “Code” button that allows you download all code pieces in the respective chapter page in a single file:
This will save an .Rmd
file of the chapter which contains the code to replicate all figures/table in the respective chapter. Note that the code assumes the existence of a ./data/
and a /functions/
subfolder within the folder in which the chapter .Rmd
file is saved. The data folder contains all the data files necessary for analysis and the functions folder contains additional functions necessary. Both folder can be downloaded here.
Your file structure should look like this (where downloaded_file.Rmd
is a placeholder for the file name of the chapter file):
|-- downloaded_file.Rmd
|-- ./data/
|-- [... data files ...]
|-- ./functions/
|-- [... function files ...]
Now, open the downloaded_file.Rmd
in RStudio, make sure your working directory is the same directory as the downloaded_file.Rmd
file and hit ctrl + shift + k.
To display and/or download the code that produced a specific figure/table, click on the button “Code” on the upper left side of the plot/table.
You can then copy and paste the code into your local R
editor. Again, that the code assumes the existence of a ./data/
and a /functions/
subfolder within the folder in which the chapter .Rmd
file is saved. The data folder contains all the data files necessary for analysis and the functions folder contains additional functions necessary. Both folder can be downloaded here.
You’ll need to install the following packages to properly run the code in this replication file (they will be loaded automatically, but need to be installed):
# Data management
install.packages("dplyr")
install.packages("tidyr")
install.packages("readr")
install.packages("readxl")
install.packages("plyr")
install.packages("countrycode")
install.packages("forcats")
install.packages("tidyverse")
install.packages("foreign")
install.packages("pastecs")
# Modelling
install.packages("rms")
install.packages("MatchIt")
install.packages("AER")
install.packages("plm")
# Plotting
install.packages("Cairo")
install.packages("ggplot2")
install.packages("cowplot")
install.packages("gridExtra")
install.packages("sparktex")
# Output
install.packages("texreg")
install.packages("xtable")
install.packages("tikzDevice")
The analysis was performed on the following platform and R
version:
sessionInfo()
## R version 3.2.3 (2015-12-10)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
##
## locale:
## [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
## [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
## [5] LC_TIME=German_Germany.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] rio_0.4.12 Matching_4.9-2 ebal_0.1-6 forcats_0.1.0
## [5] sparktex_0.1 pastecs_1.3-18 boot_1.3-17 GGally_1.3.0
## [9] lubridate_1.5.0 ivpack_1.2 AER_1.2-4 sandwich_2.3-4
## [13] lmtest_0.9-35 zoo_1.7-14 car_2.1-1 xtable_1.8-0
## [17] ggrepel_0.6.5 MatchIt_2.4-21 MASS_7.3-45 readxl_0.1.0
## [21] plm_1.5-12 reshape_0.8.5 Cairo_1.5-9 gridExtra_2.0.0
## [25] lfe_2.5-1998 Matrix_1.2-3 tikzDevice_0.9 cowplot_0.6.2
## [29] countrycode_0.18 foreign_0.8-66 dplyr_0.5.0 purrr_0.2.2
## [33] readr_1.0.0 tidyr_0.6.0 tibble_1.2 tidyverse_1.0.0
## [37] rms_4.5-0 SparseM_1.7 Hmisc_3.17-3 ggplot2_2.2.1
## [41] Formula_1.2-1 survival_2.38-3 lattice_0.20-33 texreg_1.36.23
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-126 pbkrtest_0.4-6 RColorBrewer_1.1-2
## [4] rprojroot_1.1 tools_3.2.3 backports_1.0.4
## [7] R6_2.1.2 rpart_4.1-10 DBI_0.4-1
## [10] lazyeval_0.2.0 mgcv_1.8-9 colorspace_1.3-2
## [13] nnet_7.3-11 curl_0.9.6 chron_2.3-47
## [16] quantreg_5.19 xml2_1.0.0 triebeard_0.3.0
## [19] scales_0.4.1 polspline_1.1.12 mvtnorm_1.0-4
## [22] readODS_1.6.2 stringr_1.1.0 digest_0.6.12
## [25] minqa_1.2.4 rmarkdown_1.2 base64enc_0.1-3
## [28] htmltools_0.3.5 lme4_1.1-11 jsonlite_0.9.19
## [31] acepack_1.3-3.3 magrittr_1.5 Rcpp_0.12.9
## [34] munsell_0.4.3 stringi_1.1.2 multcomp_1.4-2
## [37] yaml_2.1.13 plyr_1.8.4 grid_3.2.3
## [40] parallel_3.2.3 bdsmatrix_1.3-2 haven_1.0.0
## [43] splines_3.2.3 knitr_1.15.1 csvy_0.1.3
## [46] codetools_0.2-14 evaluate_0.10 latticeExtra_0.6-26
## [49] data.table_1.9.6 nloptr_1.0.4 urltools_1.5.1
## [52] cellranger_1.1.0 MatrixModels_0.4-1 gtable_0.2.0
## [55] assertthat_0.1 openxlsx_3.0.0 filehash_2.3
## [58] cluster_2.0.3 TH.data_1.0-7