Giter VIP home page Giter VIP logo

sv-lethals's Introduction

Replication of "Civilian Killings and Disappearances During Civil War in El Salvador (1980-92)": Instructions

Introduction

The replication directory includes five task subdirectories, numbered in the order in which they should typically be run (x01, x02...x05). Together, these five tasks create all the analyses referenced in our article, and all the tables and figures included in the article.

You will probably need to install several R packages. These include dga, diptest, tidyverse, and ggplot2. To install package X, or if any task exits with a "no package named X" error, do install.packages("X") in your R/RStudio window.

In each task, you will find three directories: input, output, and src. Input is where data goes before analysis, src contains the code for the analysis, and output is where the completed analysis (or transformed data, or what have you) goes. Here we describe both the general process for running any given task and the specific job of each task, as well as providing a list of files in each task.

Notice that matching and merging are not included in the replication package due to the nature of our data-sharing agreements and Hoover Green's human subjects protocols. It is possible to arrange to share non-anonymized data. Please contact us: [email protected] / [email protected].

To replicate one task

  1. Open a Terminal window.
  2. Navigate to the task you want to replicate using the cd command. For example, if you use a Mac, and you saved the folder "replication" on your Desktop, and you want to run the first task (x01_make_strata), open the Terminal and write

cd ~/Desktop/replication/x01_make_strata

  1. Now, in the same Terminal window, write

make clean

  1. Now type

make

  1. That's it. The task should run, barring things like missing R packages (on which, see above). If you have never used Makefiles before, you may want to check out one of these tutorials to understand how our file structure works.

http://web.mit.edu/gnu/doc/html/make_2.html https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html

What each task does

x01_make_strata

Input:

  • Anonymized, merged records (merged-records-anon.csv)

Src:

  • Code to define strata and create overlap counts for each stratum (make-strata.R)

Output:

  • List of strata (strata-list-es.csv)

x02_perform_estimates

NOTE: Depending on your machine, this task can take an hour or more to run.

Input:

  • List of strata created in x01 (strata-list-es.csv)

Src:

  • Code to perform multiple systems estimates for all strata (dga.R).

Output:

  • MSE results for each stratum (mse-results.csv);
  • Posterior probabilities for each stratum (post-probs.csv).

x03_assess_strata

Input:

  • MSE results for each stratum created in x02 (mse-results.csv)

Src:

  • Code to assess stratum quality (stratum-quality.R)

Hand:

  • This is an unusual directory; as the name implies, the data here (custom stratifications) are made BY HAND (HANDMADE-DYS-FOR-GLOBAL-SUMS.csv). This file is what we used to create custom stratifications; in it, each department-year stratum (the minimum size of stratum in this analysis) is assigned to one stratum. Sometimes those strata are the department-years themselves; other times, multiple department-years are merged into one stratum.

Output:

  • MSE results with diagnostics for each stratum (mse-results.csv)
  • Handmade custom strata (HANDMADE-DYS-FOR-GLOBAL-SUMS.csv)

x04_global_sums

Input:

  • MSE estimates with diagnostics created in x02 (mse-results.csv)
  • Posterior probabilities created in x02 (post-probs.csv)
  • Custom stratifications for global sums created in x03 (HANDMADE-DYS-FOR-GLOBAL-SUMS.csv).

Src:

  • Code that sums over stratifications to create summed global posterior probabilities (sums.R)

Output:

  • Global sums and confidence intervals (sums.rds)
  • Posterior probability draws for global sums (summed-post-probs.csv.gz)

x05_figures_tables

Input:

  • Anonymized merged records (merged-records-anon.csv)
  • Anonymized version of pre-merge records (sv-lethals-anon.csv)
  • List of strata created in x01 (strata-list-es.csv)
  • MSE results with diagnostics created in x03 (mse-results.csv)
  • Posterior probabilities created in x03 (post-probs.csv)
  • Global sums created in x04 (sums.rds)
  • Map data for El Salvador (SLV_adm1.rds)
  • Summed posterior probabilities created in x04 (summed-post-probs.csv.gz)
  • Population data (elsal-pop-data.csv)

Src:

  • Create all tables and figures for inclusion in the paper (figs-tables.R)
  • Create multiple-figure layouts (multiplot.R)

Output:

  • Figures (prior-comparison-fig.pdf, lethals-by-yr-raw-fig.pdf, lethals-by-yr-est-fig.pdf, lethals-by-dept-raw-fig.pdf, post-prob-multi2-fig.pdf, lethals-by-dept-est-fig.pdf, post-prob-violins-fig.pdf, post-prob-1981-fig.pdf)
  • Tables (bydept-table.txt, bydept-detail-table.txt, year-est-table.txt, year-cor-table-spearman.txt, overlap-table.txt, dept-cor-table-spearman.txt, bydept-table.txt)

sv-lethals's People

Contributors

ameliahg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.