I am having some trouble reporting results from a series of zero inflated poisson regressions. I am trying to use stargazer to output the results. I'm starting with the dummy data from UCLA, and some dummy regressions:
# This example comes directly from http://statistics.ats.ucla.edu/stat/r/dae/zipoisson.html
library('stargazer')
library('pscl')
library('boot')
zinb <- read.csv("https://stats.idre.ucla.edu/stat/data/fish.csv")
zinb <- within(zinb, {
nofish <- factor(nofish)
livebait <- factor(livebait)
camper <- factor(camper)
})
m1 <- zeroinfl(count ~ child + camper | persons, data = zinb)
m2 <- zeroinfl(count ~ child + camper + livebait | persons, data = zinb)
m3 <- zeroinfl(count ~ child + camper + livebait + persons | persons, data = zinb)
My problem is twofold. First, I generally use the stargazer package for output because I'm familiar with it. However, it splits the output into the zero component/logistic regression output and the poisson output. Is there a way to combine these in one output?
#stargazer for output
stargazer(m1, m2, m3,
title = "zero inflated poisson",
align = TRUE, type = "text",
column.labels = c("model1", "model2", "model3"),
star.cutoffs = c(0.05, 0.01, 0.001)
)
#stargazer for output
stargazer(m1, m2, m3,
title = "zero inflated poisson",
align = TRUE, type = "text",
column.labels = c("model1", "model2", "model3"),
star.cutoffs = c(0.05, 0.01, 0.001),
zero.component = TRUE
)
Second, I would really like to report the results for the non-zero component in IRR and the zero component in OR. I cannot figure out how to do this in stargazer. I tried the following, but can't get it work:
irrs <- lapply(list(m1, m2, m3), function(model) {
exp(coef(model))
})
#stargazer for output
stargazer(m1, m2, m3,
title = "zero inflated poisson",
align = TRUE, type = "text",
column.labels = c("model1", "model2", "model3"),
star.cutoffs = c(0.05, 0.01, 0.001),
coef = lapply(irrs, function(x) paste(round(x, 2), "IRR", sep = " x "))
)
% Error: Argument 'coef' must be NULL (default), or a list of numeric vectors.