Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svmiller/6598516864efdc1097544ece2b60c8c9 to your computer and use it in GitHub Desktop.
Save svmiller/6598516864efdc1097544ece2b60c8c9 to your computer and use it in GitHub Desktop.
Do a Fearon and Laitin (2003) type civil conflict analysis in {peacesciencer}
create_stateyears(system = 'gw') %>%
filter(year %in% c(1946:2019)) %>%
add_ucdp_acd(type=c("intrastate"), only_wars = TRUE) %>%
add_peace_years() %>%
add_democracy() %>%
add_creg_fractionalization() %>%
add_sdp_gdp() %>%
add_rugged_terrain() -> Data
Data %>%
arrange(gwcode, year) %>%
group_by(gwcode) %>%
mutate(l1_xm_qudsest = lag(xm_qudsest, 1),
l1_wbgdppc2011est = lag(wbgdppc2011est, 1),
l1_wbpopest = lag(wbpopest, 1),
l1_ucdpongoing = lag(ucdpongoing, 1)) -> Data
summary(M1 <- glm(ucdponset ~ l1_wbgdppc2011est + l1_wbpopest +
l1_xm_qudsest + I(l1_xm_qudsest^2) +
newlmtnest + ethfrac + relfrac +
splines::bs(ucdpspell, 4), data=subset(Data, l1_ucdpongoing == 0),
family = binomial(link="logit")))
summary(M2 <- glm(ucdponset ~ l1_wbgdppc2011est + l1_wbpopest +
l1_xm_qudsest + I(l1_xm_qudsest^2) +
rugged + ethfrac + relfrac +
splines::bs(ucdpspell, 4), data=subset(Data, l1_ucdpongoing == 0),
family = binomial(link="logit")))
library(modelsummary)
modelsummary(list(M1, M2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment