Consider this made-up data
require(ggplot2)
require(pscl)
require(visreg)
set.seed(23)
y = c(1005,987,784,1487,0,13,1340,451,0,784,0,451,0,0,123,754, 0, 320,0,12,0,0,87,0,0,0)
d = data.frame(
y = y,
x = 1:length(y) + runif(length(y),0,2)
)
ggplot(d, aes(y=y,x=x)) + geom_point() + geom_smooth(method='lm')
I am running a zero inflation model on this data
m = zeroinfl(y~x, dist='negbin', data=d)
print(m)
Call:
zeroinfl(formula = y ~ x, data = d, dist = "negbin")
Count model coefficients (negbin with log link):
(Intercept) x
7.4524 -0.1054
Theta = 1.181
Zero-inflation model coefficients (binomial with logit link):
(Intercept) x
-2.3405 0.1453
With these four estimates, it should be possible to compute a function to display but I am not sure how. What is my function computed by the zeroinfl function?
When I try to plot the model I get
visreg(m)
Feels about right. What function is this?