##########################################################

This replication archive contains data and code to 
reproduce the findings reported in:

####################################################
# Warren, T. Camber. 2015. "Explosive Connections? #
# Mass Media, Social Media, and the Geography of   #
# Collective Violence in African States."          #
# Journal of Peace Research 52 (3).                #
####################################################

All users of these materials should cite: Warren (2015)

In addition, users of data files derived from external 
sources should cite the original sources, as outlined in 
the "citations.txt" file included in this archive.

Please email CamberW@gmail.com with questions or comments.

##########################################################


The archive includes the following files:

####################
## 1. load_data.R ##
####################

Contains R code demonstrating the initial importation of 
data sources, and there conversion into formats suitable 
for further analysis.  

It takes two primary files as input, both of which are 
included in the archive:

"ext_dat.RData" - stores raw versions of externally 
		  derived data files

"dhs_cluster.csv" - stores data from DHS surveys, 
		    organized by geographic location

This script also loads the included ASCII-grid files:

"af_gtopo.asc" - Elevation
"af_pdens.asc" - Population Density
"af_urext.asc" - Urban Extent

It then saves the output in compressed format in a file 
called "load_data.RData", which will be placed in the 
working directory.


####################
## 2. krig_data.R ##
####################

Contains R code demonstrating the 'kriging' approach to 
spatial interpolation, including the generation of 
cross-validated prediction errors to optimize the 
selection of underlying parameters, and the generation of 
comparative error rates for the quadratic IDW approach. 

It takes as input the "load_data.RData" file created by 
the previous script.

It then saves the output in compressed format in a file 
called "krig_data.RData", which will be placed in the 
working directory.

PLEASE NOTE: These calculations are computationally 
intensive, and will likely take several hours to 
complete.  The script also includes options for parallel 
computation, which can reduce run-times substantially on 
multi-core machines.


###################
## 3. ppm_data.R ##
###################

Contains R code demonstrating the creation of independent 
and dependent variables, spatio-temporal observation 
windows, and randomized quadrature schemes, in formats 
suitable for point process modeling.

It takes as input the "load_data.RData" and 
"krig_data.RData" files created by the previous scripts.

It then saves the output in compressed format in a file 
called "ppm_data_new.RData", which will be placed in the 
working directory.


#######################
## 4. ppm_estimate.R ##
#######################

########################################################
# NOTE: Users wishing only to reproduce the results from 
# the statistical models, without altering the creation 
# of the underlying data files, can start here.
########################################################

Contains R code demonstrating the estimation of 
non-stationary, inhomogeneous point process models, for 
multivariate inference concerning spatial events.

By default, it takes as input the "ppm_data.RData" 
included in this archive.  This file contains the same 
randomly-generated quadrature points used to generate the 
findings reported in the article, and so can be used to 
generate exact replications of the results reported in 
Table 1.

Alternatively, users can execute the above scripts to 
generate "ppm_data_new.RData", and import this file 
instead, as shown in the script's comments.

