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"

Fearon and Laitin (2003) have one of the most influential state-year analyses of civil war onset to date and their research design serves as a basic template for what such a state-year analysis would resemble. What follows is not a perfect reproduction of their exact design, but an easy extension and replication of it in peacesciencer. The package’s manuscript offers a bit more detail than I include here. You might also find Gibler and Miller (2014) interesting since some of the package’s functionality is derived from what went into that particular extension of Fearon and Laitin (2003).

create_stateyears(system = 'gw', subset_years = c(1946:2024)) %>%
  add_ucdp_acd(type= "intrastate", only_wars = FALSE) %>%
  select(-maxintensity, -conflict_ids) %>%
  add_spells() %>%
  add_democracy(keep = "aeuds") %>% 
  # ^ changed from the manuscript version
  add_creg_fractionalization() %>%
  add_sim_gdp_pop(keep = c("mrgdppc", "pwtpop"))  %>%
  # ^ replaced add_sdp_gdp()
  add_rugged_terrain() -> Data
#> Joining with `by = join_by(gwcode, year)`
#> Joining with `by = join_by(orig_order)`
#> Joining with `by = join_by(gwcode, year)`
#> Joining with `by = join_by(gwcode, year)`
#> Joining with `by = join_by(gwcode, year)`
#> Joining with `by = join_by(gwcode)`

create_stateyears(system = 'gw', subset_years = c(1946:2024)) %>%
  add_ucdp_acd(type= "intrastate", only_wars = TRUE) %>%
  select(-maxintensity, -conflict_ids) %>%
  add_spells(ongo = TRUE, conflict_event_type = "onset") %>%
  rename_at(vars(ucdpongoing:ucdpspell), ~paste0("war_", .)) %>%
  left_join(Data, .) -> Data
#> Joining with `by = join_by(gwcode, year)`
#> Joining with `by = join_by(orig_order)`
#> Joining with `by = join_by(gwcode, gw_name, microstate, year)`

Data %>%
  arrange(gwcode, year) %>%
  log_at(c("mrgdppc", "pwtpop")) %>%
  lag_at(c("aeuds", "ln_mrgdppc", "ln_pwtpop"),
         .by = "gwcode") -> Data


modCW <- list()
modCW$"All UCDP Conflicts" <- glm(ucdponset ~ l1_ln_mrgdppc + l1_ln_pwtpop  +
                    l1_aeuds + I(l1_aeuds^2) +
                    newlmtnest + ethfrac + relfrac +
                    ucdpspell + I(ucdpspell^2) + I(ucdpspell^3), data=subset(Data),
                  family = binomial(link="logit"))

modCW$"Wars Only"  <- glm(war_ucdponset ~ l1_ln_mrgdppc + l1_ln_pwtpop  +
                    l1_aeuds + I(l1_aeuds^2) +
                    newlmtnest + ethfrac + relfrac +
                    war_ucdpspell + I(war_ucdpspell^2) + I(war_ucdpspell^3), data=subset(Data),
                  family = binomial(link="logit"))

In table form:

modelsummary(modCW, 
             title = 'A Civil Conflict Analysis of Gleditsch-Ward State-Years in {peacesciencer}',
             stars = c('*' = .05, '+' = .1), gof_omit = "IC|F|Log.|R2$",
             coef_map = c("l1_ln_mrgdppc" = "GDP per Capita (Lagged)", 
                          "l1_ln_pwtpop" = "Population Size (Lagged)", 
                          "l1_aeuds" = "Extended UDS (Lagged)",
                          "I(l1_aeuds^2)" = "Extended UDS^2 (Lagged)", 
                          "newlmtnest" = "% Mountainous Terrain (Logged)", 
                          "ethfrac" = "Ethnic Fractionalization", 
                          "relfrac" = "Religious Fractionalization",
                          "ucdpspell" = "t",
                          "I(ucdpspell^2)" = "t^2",
                          "I(ucdpspell^3)" = "t^3",
                          "war_ucdpspell" = "t",
                          "I(war_ucdpspell^2)" = "t^2",
                          "I(war_ucdpspell^3)" = "t^3",
                          "(Intercept)" = "Intercept"),
             align=c("lcc"))
A Civil Conflict Analysis of Gleditsch-Ward State-Years in {peacesciencer}
All UCDP Conflicts Wars Only
GDP per Capita (Lagged) −0.290* −0.220
(0.113) (0.174)
Population Size (Lagged) 0.242* 0.263*
(0.068) (0.106)
Extended UDS (Lagged) −0.802* −1.085*
(0.239) (0.420)
Extended UDS^2 (Lagged) −0.883* −0.831*
(0.233) (0.370)
% Mountainous Terrain (Logged) 0.067 0.297*
(0.067) (0.111)
Ethnic Fractionalization 0.371 0.349
(0.357) (0.559)
Religious Fractionalization −0.283 −0.061
(0.400) (0.598)
t −0.065+ −0.149*
(0.039) (0.064)
t^2 0.004+ 0.006*
(0.002) (0.003)
t^3 0.000+ 0.000+
(0.000) (0.000)
Intercept −2.124* −3.860*
(0.995) (1.555)
Num.Obs. 8192 8189
RMSE 0.13 0.08
+ p < 0.1, * p < 0.05