Reputation: 23
I have replicated a zero-inflated negative binomial model (model 1, table 1) from the article:
Scharpf, Adam. 2020. “Why Governments Have Their Troops Trained Abroad: Evidence from Latin America.” International Studies Quarterly 64 (3): 734–47. https://doi.org/10.1093/isq/sqaa043
The data can be found here: https://dataverse.harvard.edu/file.xhtml?fileId=5117253&version=1.0
My problem lies in the assessment and comparison of model 1 and a poisson model (with the same data).
I have successfully made a histogram of observed and predicted outcomes of the original model 1 in order to assess the model, but when I make the histogram of predicted outcomes for the poisson model I get the same spread as with the zero-inflated negative binomial. I know something isn't right because I've also assessed the models with rootograms, and there is a clear difference...
I'll upload the code for the different models:
Zero-inflated negative binomial:
library(pscl)
library(dplyr)
library(ggplot2)
datayus <- read.table("https://dataverse.harvard.edu/api/access/datafile/5117253?format=tab&gbrecs=true", header=TRUE, sep="\t")
model1 <- zeroinfl(soaGEN ~
lguerrillad +
lstrikesd +
ldemond +
lriotsd +
ldmidtoward | lfpsimusa,
dist="negbin",
datayus)
datayus$pred.model1 <- predict(model1,
newdata = datayus,
type = "response")
datayus %>%
ggplot() +
geom_histogram(aes(x = soaGEN), alpha = 0.5) +
geom_histogram(aes(x = pred.model1), fill = "red", alpha = 0.3)+
theme_minimal() +
ggtitle("Fordeling mellem observerede og forudsagte outcomes") +
ylab("Frekvens") +
xlab("Deltagelse på SOA")
Poisson model:
mod.pois <- glm(soaGEN ~
lguerrillad +
lstrikesd +
ldemond +
lriotsd +
ldmidtoward + lfpsimusa,
family ="poisson",
datayus)
datayus$pred.pois <- predict(mod.pois,
newdata = datayus,
"response")
datayus %>%
ggplot() +
geom_histogram(aes(x = soaGEN), alpha = 0.5) +
geom_histogram(aes(x = pred.pois), fill = "red", alpha = 0.3) +
theme_minimal() +
ggtitle("Fordeling mellem observerede og forudsagte outcomes") +
ylab("Antal optrædener") +
xlab("Deltagelse på SOA")
I hope someone will be able to help.
Upvotes: 2
Views: 111