Code and data to replicate results for our paper on Trading Communities, the Networked Structure of International Relations, and the Kantian Peace.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
src
Lupu_Traag_Erratum.bib
Lupu_Traag_Erratum.pdf
Lupu_Traag_Erratum.tex
README.md

README.md

Erratum

This repository contains the data and code needed to replicate the results in the erratum to Lupu and Traag (2013).

DOI

Overview

Please clone using git clone or download the zipped repository and unzip to your desired location.

This repository contains two directories: src and data.

The data directory contains all primary data to replicate the results. This is based on the following data sources:

The src directory contains all code needed to run the replication. It contains two files:

  • network_analysis.py should be run first, in Python.
  • merge_recode_regress_stata.txt should be run second, in Stata.

The Python code performs the following:

  • define the trade network based on the Gleditsch (2000) data in dependence.dta.
  • calculate maxflow in the network.
  • detect communities using Louvain modularity maximization algorithm.
    • each country-year is assigned a community ID.
    • this is performed 100 times each using three resolution parameters (0.6, 1.1 and 1.7).
  • create the Same Trading Community variable.
    • for each resolution level, a dyad-year is coded as 1 if the dyad-year members are in the same trading community in 50 or more of the runs, and 0 otherwise.

The resulting maxflow will be written to the file maxflow.csv in the directory results (this directory will be created by the code). The resulting partitions will be written to files comms_x.x.csv for the different resolution parameters in the directory results. The dyadic Same Trading Community variable will be written to files dyads_x.x.csv for the different resolution parameters in the same directory.

The Stata code performs the following:

  • calculate the mean value of the two directed maxflow measures for each dyad-year. This mean value is used in the logit models.
  • merge the Same Trading Community and maxflow with data on conflict and control variables.
  • recode some control variables (e.g., population is logged, missing data categories (e.g., -66, -77, -88) in Polity are coded as missing, etc.)
  • generate cubic splines.
  • lead the dependent variable by one year.
  • estimate the logit models reported in the erratum and export to Latex.

The resulting LaTeX table will be written to the file myfile.tex.

Installation instructions

In order to run the code, make sure you have Python installed. It is usually most convenient to install the Anaconda Python distribution. Some other libraries will be required by to run the code:

  • python-igraph (>= 0.7.1)
  • louvain-igraph (>= 0.6.1)
  • pandas (>= 0.20)
  • numpy (>= 1.13)

You should be able to install all these libraries on all platforms (Windows, Mac OS, Linux) using conda install. Possibly you may have to add the Anaconda channel conda-forge and/or vtraag. For more details, you can search for these packages on https://anaconda.org/.

For Stata please ensure you have version 13 or higher.

References

Gleditsch, Kristian S. 2002. "Expanded Trade and GDP Data." Journal of Conflict Resolution 46 (5): 712-724. doi: 10.1177/0022002702046005006

Lupu, Yonatan and Vincent A Traag. 2013. "Trading communities, the networked structure of international relations, and the Kantian peace." Journal of Conflict Resolution 57 (6): 1011-1042. doi: 10.1177/0022002712453708

Maoz, Zeev 2005. Dyadic MID Dataset (version 2.0): http://psfaculty.ucdavis.edu/zmaoz/dyadmid.html.

Marshall, Monty, and Keith Jaggers. 2002. "Polity IV Project: Political Regime Characteristics and Transitions, 1800-2002." University of Maryland

Pevehouse, Jon C., Timothy Nordstrom, and Kevin Warnke. 2004. "The Correlates of War 2 International Governmental Organizations Data Version 2.0." Conflict Management and Peace Science 21 (2): 101-19. doi: 10.1080/07388940490463933

Singer, J. David, and Melvin Small. 1966. "Formal Alliances, 1815-1939: A Quantitative Description." Journal of Peace Research 3 (1): 1–32. doi: 10.1177/002234336600300101