# Predicting future values with hurdle Poisson model

I executed a hurdle Poisson model on test dataset that contains one y (dependent variable) and one x (independent variable).

head(df)

y       width
8       34.4
0       22.5
3       28.34
7       32.22


The output is as shown below.

Count model coefficients (truncated poisson with log link):
(Intercept)        width
0.58915      0.03386

Zero hurdle model coefficients (binomial with logit link):
(Intercept)        width
-12.3508       0.4972


I am not sure how to compute the value of y for a future value of x , say x (width) was 34.3. Any help is much appreciated.

The basic idea is 'success probability of binomial distribution' * 'lambda (= an expected value) of poisson distribution'. But you have to consider that the poisson model in count part never returns 0.

I supposed your example data and predicted when width is c(23, 26, 29).

library(pscl)
data <- data.frame(y = c(8, 0, 3, 7), width = c(34.40, 22.50, 28.34, 32.22))

model <- hurdle(y ~ width, data = data)
model
# Count model coefficients (truncated poisson with log link):
# (Intercept)        width
#     -3.4520       0.1629    # model$coef$count[[1]] (left); model$coef$count[[2]] (right)

# Zero hurdle model coefficients (binomial with logit link):
# (Intercept)        width
#    -198.851        7.809    # model$coef$zero[[1]] (left); model$coef$zero[[2]] (right)


First, you calculate a success probability of a binomial model, phi_zero, (logistic equation). (I attached a taking log version because of predict() uses it.)

phi_zero <- 1 / ( 1 + exp(-(model$coef$zero[[1]] + model$coef$zero[[2]] * c(23, 26, 29))))
# p0_zero <- log(phi_zero)


Second, you calculate a param (= expected value) of a poisson model, mu, and the > 0 probability, phi_count.

mu <- exp(model$coef$count[[1]] + model$coef$count[[2]] * c(23, 26, 29))
phi_count <- ppois(0, lambda = mu, lower.tail = F)  # not 0 probability
# p0_count <- ppois(0, lambda = mu, lower.tail = F, log.p = T)


Finally, you integrate values of both model.

phi <- phi_zero / phi_count  # because there isn't 0 coming from poisson.
rval <- phi * mu
# logphi <- p0_zero - p0_count
# rval2 <- exp(logphi + log(mu))
rval
# [1] 8.051324e-09 2.429582e+00 3.674317e+00


And predict() takes a class hurdle as an argument (see ?predict.hurdle).

predict(model, data.frame(width = c(23, 26, 29)), type = "response")
#            1            2            3
# 8.051324e-09 2.429582e+00 3.674317e+00     # the same


Hurdle models are also called two-part models. They are useful to implement count data with many zeros.

In the first step the probability is computed, that the dependent variable is zero, or a positive number. This table should be interpreted just like a logit regression.

Zero hurdle model coefficients (binomial with logit link):
(Intercept)        width
-12.3508       0.4972


Now the algorithm is divided into zeros and ones. The zeros in our case are the cases in which the dependent variable takes on the value 0. The ones in our case are the cases in which the dependent variable takes on a positiv integer.

Count model coefficients (truncated poisson with log link):
(Intercept)        width
0.58915      0.03386


Under the condition that the dependent variable is a positive integer (not zero), you can compute the value of width=34 in the following equation -12.3508 + 34 * 0.4972

To point it out in an example:

1. You want to count the number of cigarettes adults are smoking per day in Germany.
2. You decide to use a count data model, because the number of cigarettes is a count variable
3. As there are many zeros in your dataset (most people in Germany don´t smoke at all) you stick to a hurdle Poisson modell.
4. Now the zero hurdle model coefficients calculate whether the person is actually smoking or not smoking at all.
5. Among those who smoke the Count model coefficient forecast how much cigarettes a smoker is going to smoke per day.
• ah so this is a two step process. First I compute if the y is zero, by fitting the zero parameters as a binomial model. If the p value turns out to be more than the cutoff , say 0.5, in this case p was 0.9936 , then I assume that y >=1 and execute the poison model. to calculate the actual value of y is this correct ? Sep 14 '16 at 15:14
• Yes. you can do it. Nonetheless you should be aware that the coefficients of a logistic regression are not the absolut coefficients, but marginal sensitivities. Furthermore it is not recommended that zero-inflated Poisson models be applied to small samples. You can also try the zero-inflated poisson regression (implemented in the pscl package in R with the following code)**summary(yourresults <- zeroinfl(y ~ width | width, data = yourdata))** Zero-inflated and two-part (hurdle-models) should lead to very similar results as they both are designed to treat zero-inflated count data. Sep 15 '16 at 6:24