Skip to contents
library(tidyverse)
library(peacesciencer)
library(lubridate)
library(stevemisc)
library(modelsummary)

packageVersion("peacesciencer")
#> [1] '1.1.9'
Sys.Date()
#> [1] "2025-07-10"

Bremer’s (1992) “dangerous dyads” design is not necessarily the seminal analysis of inter-state conflict in the Correlates of War tradition, but it’s arguably the seminal template by which one could analyze conflict between states. The package’s manuscript offers a basic extension/replication of this form of analyze, the skeleton of which is ubiquitous in every dyad-year analysis.

create_dyadyears(directed = FALSE, subset_years = c(1816:2010)) %>%
  filter_prd() %>%
  # add conflict information from GML-MID data, pipe to next function
  add_gml_mids(keep = NULL) %>%
  add_spells() %>%
  add_nmc() %>%
  add_democracy(keep="aeuds") %>%
  add_atop_alliance() %>% # change from manuscript version
  # likewise, this function below replaces add_sdp_gdp() since version 1.2
  add_sim_gdp_pop(keep="mrgdppc") -> Data
#> Joining with `by = join_by(ccode1, ccode2, year)`
#> Dyadic data are non-directed and initiation variables make no sense in this
#> context.
#> Joining with `by = join_by(ccode1, ccode2, year)`
#> add_gml_mids() IMPORTANT MESSAGE: By default, this function whittles
#> dispute-year data into dyad-year data by first selecting on unique onsets.
#> Thereafter, where duplicates remain, it whittles dispute-year data into
#> dyad-year data in the following order: 1) retaining highest `fatality`, 2)
#> retaining highest `hostlev`, 3) retaining highest estimated `mindur`, 4)
#> retaining highest estimated `maxdur`, 5) retaining reciprocated over
#> non-reciprocated observations, 6) retaining the observation with the lowest
#> start month, and, where duplicates still remained (and they don't), 7) forcibly
#> dropping all duplicates for observations that are otherwise very similar. See:
#> http://svmiller.com/peacesciencer/articles/coerce-dispute-year-dyad-year.html
#> Joining with `by = join_by(orig_order)`
#> Joining with `by = join_by(ccode1, ccode2, year)`

# Some recoding
Data %>%
  mutate(landcontig = ifelse(conttype == 1, 1, 0)) %>%
  mutate(cowmajdyad = ifelse(cowmaj1 == 1 | cowmaj2 == 1, 1, 0)) %>%
  # Create estimate of militarization as milper/tpop
  # Then make a weak-link
  mutate(milit1 = milper1/tpop1,
         milit2 = milper2/tpop2,
         minmilit = ifelse(milit1 > milit2,
                           milit2, milit1)) %>%
  # create CINC proportion (lower over higher)
  mutate(cincprop = ifelse(cinc1 > cinc2,
                           cinc2/cinc1, cinc1/cinc2)) %>%
  # create weak-link specification using Quick UDS data
  mutate(mindemest = ifelse(aeuds1 > aeuds2,
                            aeuds2, aeuds1)) %>%
  # Create "weak-link" measure of jointly advanced economies
  mutate(minmgdppc = ifelse(mrgdppc1 > mrgdppc2,
                             mrgdppc2, mrgdppc1)) -> Data

Data %>%
  r2sd_at(c("cincprop", "mindemest", "minmgdppc", "minmilit")) -> Data

modDD <- glm(gmlmidonset ~ landcontig + cincprop + cowmajdyad + atop_defense +
               mindemest + minmgdppc + minmilit +
               gmlmidspell + I(gmlmidspell^2) + I(gmlmidspell^3), data= Data,
             family=binomial(link="logit"))

In table form:

modelsummary(list("Model 1" = modDD), 
             title = 'A "Dangerous Dyads" Analysis of Non-Directed Dyad-Years from {peacesciencer}',
             stars = c('*' = .05, '+' = .1), 
             gof_map = c("nobs"),
             coef_map = c("landcontig" = "Land Contiguity", 
                          "cincprop" = "Dyadic CINC Proportion (Lower/Higher)", 
                          "cowmajdyad" = "CoW Major Power in Dyad",
                          "atop_defense" = "Defense Pact", 
                          "mindemest" = "Dyadic Democracy (Weak-Link)", 
                          "minmgdppc" = "Dyadic GDP per Capita (Weak-Link)", 
                          "minmilit" = "Dyadic Militarization (Minimum)",
                          "gmlmidspell" = "t",
                          "I(gmlmidspell^2)" = "t^2",
                          "I(gmlmidspell^3)" = "t^3",
                          "(Intercept)" = "Intercept"),
             align=c("lc")) 
A “Dangerous Dyads” Analysis of Non-Directed Dyad-Years from {peacesciencer}
Model 1
Land Contiguity 1.057*
(0.058)
Dyadic CINC Proportion (Lower/Higher) 1.055*
(0.082)
CoW Major Power in Dyad 0.113+
(0.059)
Defense Pact −0.132*
(0.058)
Dyadic Democracy (Weak-Link) −0.272*
(0.032)
Dyadic GDP per Capita (Weak-Link) 0.000+
(0.000)
Dyadic Militarization (Minimum) 30.152*
(2.378)
t −0.146*
(0.005)
t^2 0.003*
(0.000)
t^3 0.000*
(0.000)
Intercept −3.517*
(0.076)
Num.Obs. 106056
+ p < 0.1, * p < 0.05