Outcomes after civil war in countries with and without United Nations peacekeeping. See Chapter 1 in Regression and Other Stories.
library("rprojroot")
root<-has_file(".ROS-Examples-root")$make_fix_file()
library("foreign")
peace <- read.dta(root("Peacekeeping/data","pk&pkept_old.dta"))
censored <- peace$morewar==0
badness <- log(peace$hazard1)
peacekeepers <- peace$pk_dum==1
cfdate <- peace$cfdate
faildate <- peace$faildate
faildate[is.na(faildate)&!is.na(cfdate)] <- "2004-12-31"
delay <- (as.numeric(faildate) - as.numeric(cfdate))/365.24
ok <- peace$pcw==1 & !is.na(delay)
##ok <- cease_fire & !is.na(badness) & peace$t0 > 1979-12-31 & peace$pcw==1
print(sum(ok))
[1] 96
print(mean(censored[ok]))
[1] 0.4166667
print(unique(peace[ok,3]))
[1] "Afghanistan-Mujahideen" "Afghanistan-Taliban" "Algeria-FIS/AIS"
[4] "Angola" "Azerbaijan-N.K." "Bangladesh-CHT"
[7] "Myanmar-Karen" "Myanmar-Kachin" "Cambodia"
[10] "Central African Rep." "Chad" "Congo Brazzaville"
[13] "Congo-Brazzaville" "CongoD.R./Zaire" "Djibouti"
[16] "Egypt" "El Salvador" "Ethiopia-Eritrea"
[19] "Ethiopia-ideology" "Georgia-Abkhazia" "Georgia-Ossetia"
[22] "Guatemala" "Guinea-Bissau" "Haiti"
[25] "India-Assam" "India-Sikh" "Indonesia-Aceh"
[28] "Indonesia-E. Timor" "Iraq-Kurds" "Iraq-Shia"
[31] "Israel-Palestinians" "Lebanon" "Liberia"
[34] "Mali" "Moldova" "Morocco/WestSah"
[37] "Mozambique" "Namibia" "Nicaragua"
[40] "U.K.-N. Ireland" "Pakistan-Mohajirs" "Papua New Guinea"
[43] "Peru" "Philippines-Communists" "Philippines-Mindanao"
[46] "Romania" "Russia-Chechnya" "Rwanda"
[49] "Senegal" "Sierra Leone" "Somalia"
[52] "South Africa" "Sri Lanka (Tamil)" "Sri Lanka (JVP II)"
[55] "Sudan" "Tajikistan" "Turkey-Kurds"
[58] "Uganda-Kony" "Uganda-LRA" "Yemen"
[61] "Bosnia" "Yugoslavia-Croatia" "Croatia"
[64] "Yugoslavia-Kosovo"
print(mean(censored[ok & peacekeepers]))
[1] 0.5588235
print(mean(censored[ok & !peacekeepers]))
[1] 0.3387097
print(mean(delay[ok & !censored & peacekeepers]))
[1] 1.381375
print(mean(delay[ok & !censored & !peacekeepers]))
[1] 1.515742
print(median(delay[ok & !censored & peacekeepers]))
[1] 1.054101
print(median(delay[ok & !censored & !peacekeepers]))
[1] 0.588654
par(mfrow=c(1,2), mar=c(3,5,3,0), mgp=c(1.5,.5,0), tck=-.01)
subset <- ok & peacekeepers
hist(delay[subset & !censored], xlim=c(0,8), breaks=seq(0,8,.5), xlab="Years until return of war", ylab="", main=paste("With peacekeeping: ", round(100*mean(censored[subset])), "% of countries stayed at peace.\nFor others, histogram of time until civil war returned:", sep=""), cex.main=.9, cex.axis=.9, cex.lab=.9)
subset <- ok & !peacekeepers
hist(delay[subset & !censored], xlim=c(0,8), breaks=seq(0,8,.5), xlab="Years until return of war", ylab="", main=paste("Without peacekeeping: ", round(100*mean(censored[subset])), "% stayed at peace.\nFor others, histogram of time until civil war returned:", sep=""), cex.main=.9, cex.axis=.9, cex.lab=.9)
ok2 <- ok & !is.na(badness)
badness2 <- badness/2 + 8
par(mar=c(3,4,2,0), tck=-.01, mgp=c(1.7,.5,0))
plot(badness2[ok2], delay[ok2], type="n", xlab="Pre-treatment measure of problems with the country", ylab="Delay (in years) before return of conflict\n(open circles indicate conflict has not yet returned)", bty="n", xaxt="n")
axis(1, quantile(badness2[ok2], c(.05, .95)), c("not so bad", "really bad"))
axis(1, range(badness2[ok2]), c("",""), tck=0)
points(badness2[ok2&peacekeepers&!censored], delay[ok2&peacekeepers&!censored], col="red", pch=20, cex=.9) # dot
points(badness2[ok2&!peacekeepers&!censored], delay[ok2&!peacekeepers&!censored], col="black", pch=20, cex=.9) # dot
points(badness2[ok2&peacekeepers&censored], delay[ok2&peacekeepers&censored], col="red", pch=21) # circle
points(badness2[ok2&!peacekeepers&censored], delay[ok2&!peacekeepers&censored], col="black", pch=21) # circle
mtext("Peacekeeping (red) is associated with slightly longer periods without war", line=1)
par(mfrow=c(1,2), mar=c(3,4,2,0), tck=-.01, mgp=c(1.7,.5,0))
ok2a <- ok&peacekeepers
plot(badness2[ok2], delay[ok2], type="n", xlab="Pre-treatment measure of problems with the country", ylab="Delay (in years) before return of conflict\n(open circles where conflict did not return)", bty="n", xaxt="n")
axis(1, quantile(badness2[ok2], c(.05, .95)), c("not so bad", "really bad"))
axis(1, range(badness2[ok2]), c("",""), tck=0)
points(badness2[ok2a&peacekeepers&!censored], delay[ok2a&peacekeepers&!censored], col="black", pch=20, cex=.6) # dot
points(badness2[ok2a&peacekeepers&censored], delay[ok2a&peacekeepers&censored], col="black", pch=1, cex=1.1) # circle
mtext("With U.N. peacekeeping", line=1, cex=1.1)
ok2b <- ok&!peacekeepers
plot(badness2[ok2], delay[ok2], type="n", xlab="Pre-treatment measure of problems with the country", ylab="", bty="n", xaxt="n")
axis(1, quantile(badness2[ok2], c(.05, .95)), c("not so bad", "really bad"))
axis(1, range(badness2[ok2]), c("",""), tck=0)
points(badness2[ok2b&!peacekeepers&!censored], delay[ok2b&!peacekeepers&!censored], col="black", pch=20, cex=.6) # dot
points(badness2[ok2b&!peacekeepers&censored], delay[ok2b&!peacekeepers&censored], col="black", pch=1, cex=1.1) # circle
mtext("Without U.N. peacekeeping", line=1, cex=1.1)
log.delay <- log(delay)
plot (badness[ok], log.delay[ok], type="n", xlab="badness", ylab="delay")
points (badness[ok&peacekeepers], log.delay[ok&peacekeepers], pch=21) # circle
points (badness[ok&!peacekeepers], log.delay[ok&!peacekeepers], pch=20) # bullet
sqrt.delay <- sqrt(delay)
plot (badness[ok], sqrt.delay[ok], type="n", xlab="badness", ylab="delay")
points (badness[ok&peacekeepers], sqrt.delay[ok&peacekeepers], pch=21) # circle
points (badness[ok&!peacekeepers], sqrt.delay[ok&!peacekeepers], pch=20) # bullet
table(peacekeepers[ok], censored[ok])
FALSE TRUE
FALSE 41 21
TRUE 15 19
par(mfrow=c(2,2))
time <- as.numeric (cfdate)
hist(time[peacekeepers&ok])
hist(time[!peacekeepers&ok])
## minidata <- cbind (cfdate, faildate, peacekeepers, round(badness,2), round(delay,2), censored)[ok,]
## rownames (minidata) <- peace$cname[ok]
## colnames (minidata) <- c ("cfdate", "faildate", "peacekeepers?", "badness", "delay", "censored?")
## write.csv(minidata, "minidata.csv")