I would like to plot a rootogram
for a quasipoisson
model. The countreg package works really well for poisson and for negative binomial but it says "family currently not supported" for quasipoisson models.
I know that the packages vcd
and latticeExtra
can also plot rootograms. Unfortunately, when I try to plot a rootogram
of a quasipoisson
model with these packages I receive error messages.
Here some code for all three packages:
#some data for replication)
y <- rpois(100, 3)
x1 <- c(rep(0, 50), rep(1, 50))
x2 <- rnorm(100, 1000, 300)
data <- data.frame(y, x1, x2)
library(countreg)
countreg::rootogram(glm(y~x1 +x2, data = data, family = quasipoisson))
produces error:
Error in rootogram.glm(glm(y ~ x1 + x2, data = data, family = quasipoisson)) : family currently not supported
library(vcd)
vcd::rootogram(glm(y~x1 + x2, data = data, family = quasipoisson))
produces error:
Error in rootogram.default(glm(y ~ x1 + x2, data = data, family = quasipoisson)) : argument "fitted" is missing, with no default
library(latticeExtra)
latticeExtra::rootogram(glm(y ~ x1 + x2, data = data, family = quasipoisson))
produces error:
Error in sqrt(as.vector(object)) : non-numeric argument to mathematical function
In addition: Warning message:
In rootogram.default(glm(y ~ x1 + x2, data = data, family = quasipoisson)) : NAs introduced by coercion