The scripts and data in this folder will reproduce all of the results, 
both in the maintext and appendix, of de la Cuesta et al (2019). 
All scripts can be run by setting the working directory to 
the source file location. Below is a description of key files: 

###### SCRIPTS

replication_maintext.R - Reproduces the two figures in the main text as well
as the analysis used to produce them. 

replication_appendix.R - Analysis script that replicates all estimates
presented in the appendix. The one exception is Table S1; because it is
a summary statistics table it is produced directly in the tables_appendix.R
script. The analysis is split into four sections: main results, subgroup effects,
randomization inference results, and MP results. At the end of each section
the script will save an RData object with all the results produced in that section.
These results are then called in the tables_appendix.R script. 

tables_appendix.R - Table script that calls the results generated by 
replicaton_appendix. There are separate scripts that generate the tables
for each appendix section. These are contained in \table scripts 
and are called one-by-one in the tables_appendix.R script. 

The scripts require several dependencies to successfully run the randomization inference:
- emmeans
- estimatr
- ri2
- randomizer

You may need to update ri2 to the latest version if the package was installed prior to 2019 (version 0.1.2).


###### RESULTS

The replication_appendix.R script produces several sets of results, each corresponding
to a different set of analysis. There are six in total, three each for the mass and 
citizen samples. Results with the _maineffects suffix refer to the main effects sections
of the appendix. Results with the _ri suffix refer to the randomization estimates, and
results with the _heteffects suffix refer to the heterogeneous effects results. 
Which sample the results are for is denoted by the mp_ (for MPs) and mass_ (for citizens)
prefixes.  

###### DATA 

The /data folder includes the data used for analysis in four separate RData files. 
All data files include the original dataset as well as the five imputed datasets.
These datasets are stacked on top of each other and distinguished with the "imp"
variable. The unimputed dataset takes a value of "0" on the imp variable. 

ghana_citizen_imputed_full.RData -- the full-sample data for Ghana
ghana_citizen_imputed_manip.RData -- the sample that passed the manipulation check in Ghana
uganda_citizen_imputed_full.RData -- the full-sample data for Uganda
uganda_citizen_imputed_manip.RData -- the sample that passed the manipulation check in Uganda
ghana_mp_full.RData -- full sample of Ghanaian MPs
uganda_mp_full.RData -- full sample of Ugandan MPs

Imputation was conducted only for the citizen sample. The two MP datasets
thus contain no "imp" variable and only a single dataset. 


######### FIGURES

The /figures folder includes the two main figures of the maintext 
in Fig1.pdf and Fig2.pdf. These visualize the results for the three
main indices for the citizen sample (Fig 1) and the elite survey (Fig 2). 

######### ADDITIONAL DOCUMENTS

There are two additional documents designed to aid in the exploration
and replication of the data.

codebook.xlsx - gives the names and brief description for all 
variables used in the analysis. Note that there are two tabs,
one for the citizen sample and one for the elite sample. 

mass_analysis_varinfo.csv - provides the full list of dependent variables 
and related information. Used by the maintext and replication scripts
to ensure uniformity in estimation, plotting and tables. 

mp_analysis_varinfo.csv - similar information as above but for MPs