All analysis was conducted using R 3.6.3. The following files will conduct the replication:
replication.shRunning this file will replicate all tables and figures in the main text. The log fileJPR_logFile_mainTxt.txtrecords the output of running this file. Figures 1 & 2 are output as PDF files.repicate_appendix.shRunning this file will replicate all tables and figures in the online appendix. The log fileJPR_logFile_appendix.txtrecords the output of running this file. Figures D1-4 are output as PDF files.
The following R packages are used in this analysis
DEoptim(2.2-4)matrixStats(0.54.0)doParallel(1.0.15)doRNG(1.7.1)data.table(1.12.8)stringr(1.4.0)ggplot2(3.1.1)gridExtra(2.3)
Starting values are very important for the optimization. The folder labeled startingvalues includes the (time and resource intensive) global optimization routines used to produce starting values. They are not run within the main replication package, but are included as additional information for replicators.
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
DataContains data files used in the analysisFearonLaitin.dtaFearon and Laitin's 2003 APSR datafearonOutOfSample.csvCase from Fearon's 2004 JPR that are not in UCDP.fullDataSet.csvThe main data set used in this paperNMC_v4_0.csvCorrelates of War NMC datawoa_USE*A series ofRdatafiles that are used to fit the various models. Each one is designed for a specific robustness check. See the appendix for more detials.
functionsContains additional functions used in the projectavdata.rA function to compute "average" data profiledeoptimWrap.rA function to customize howDEoptimis use. Mainly used to control the parallel optionsestimationFunctions2018.Rloglikelihood and other functions
startingvaluesA folder containing code to produce and save starting values for each modelmodel*_startvalues.RCode to produce starting values for each model 0-11model*start_currentIT.rdataFile produced along the way the save the current output ofDEoptimmodel*startvalues.rdataFile that contains the produced starting values
analyze_MonteCarlo.rAnalyze the main Monte Carlo simulationanalyze_MonteCarlo_section.rAnalyze the Monte Carlo with missing 0scodebook.mddescription file forfullDataSet.csvfigure*.pdfFigure in PDF formatfigure*.RCode to produce the figureJPR_logFile_appendix.txtLogged output from running the appendix filesJPR_logFile_mainText.txtLogged output from running the main text filesMCresult_main.pdfFigure A.1 in pdf formatmodel*_fit.RCode to fit models 0-11. Consdult the bash (.sh) files for the ordering and the log files to see which files match which Tables. The main text models are 1, 2, and 7. Models 3-6 and 8-11 are in the Appendix (in order) and model 0 is used only for model fit comparisions.model*_bootstrap.rBootstrap code for models 1-11.model*_bootstrap.rdataSaved bootstrap resultsmodelfit.rCode for model fit exercises (Appendix F)MonteCarloExperiment.rCode to run the Monte Carlo simulationMonteCarloExperiment_selection.rCode to run the Monte Carlo simulation with missing casesMonteCarloResults.rdataSaved results of the main Monte CarloMonteCarloResults_section.rdataSaved results of the Monte Carlo simulation with missing casesnullModel.RdataSave results of Model 0. A null model used for model fitreadme.mdthis filereplicate.shthe bash script that runs all the files used in the main analysis. The text output is recorded inJPR_logFile_mainText.txtreplicate_appendix.shthe bash script that runs all the files used in the online appendix. The text output is recorded inJPR_logFile_appendix.txtsummary.RProduce summary statistics table in Appendix C