I am trying to fit a Bayesian Zero-inflated model and I want to include an offset term. When I compared the output of the pscl package; the result of the count model from the winbugs and pscl package were similar. While the results of the zero-inflated part from the bayesian model and pscl package were quite disimilar.

The problem is how to include the offset on zero-inflated part.

## Likelihood
for(i in 1:N){
count[i] ~ dpois(lambda[i])
lambda[i] <- lambda.new[i]*(1-zero.count[i]) + 1e-10*zero.count[i]
log(lambda.new[i]) <- beta[1] + beta[2]*edu[i] + log(person_time[i])

## Zero-Inflation
zero.count[i] ~ dbern(pi[i])
pi[i] <- ilogit(pi.new[i])
# I am not quite certain if this is correctly specified
pi.new[i] <- alpha[1] + alpha[2]*edu[i] + log(person_time[i]) 
## Priors
beta ~ dmnorm(0,1.0E-6)
alpha ~ dmnorm(0,1.0E-6)

Please I can I correctly specify the offset for the zero inflation part in the model above so as to obtain similar result as produced by the zeroinfl function in pscl package?

  • $\begingroup$ The results of the count model are similar to what? The results of the zero-inflated part are different from what? $\endgroup$
    – AdamO
    Jan 29, 2020 at 15:27
  • $\begingroup$ I compared the Bayesian output and frequentist output ( pscl package) $\endgroup$
    – tk001
    Jan 29, 2020 at 15:55

1 Answer 1


You have to do some deep thinking about counting mixture processes with imbalanced design. The wrinkle of unequal follow-up duration needs a clearly specified model. Simply adding log(person_time) to the binary zero vs. Poisson part is not the right approach. The implication, in fact, is that observing a zero-generator longer means they would be more likely to spontaneously generate counts, which is the exact opposite of what you're trying to do.

The Poisson process benefits greatly from the memoryless interarrival times of events. As a result, you can slice-and-dice or aggregate counts over intervals without having issues of correlated data through repeated measures. e.g. a person followed ten years can be compared to a person followed one year through a simple offset.

But what can we say of the precision or confidence in our zero count in following someone for 10 years without a single count versus someone we follow over 1 year with as many? Surely we are more confident of their follow-up suggesting they are actually a zero-count generator. A pseudolikelihood approach might say that the person observed 10 years did, say, 10 Bernoulli trials and all came up negative.

In other words, we modify the dbern statement. The likelihood becomes:

$$\log d(\pi_i, T_i) = T_i \times \left( \log \pi_i + \log (1-\pi_i)\right)$$

But as a function of covariates, the nonlinear model for $\pi$ should not be a function of follow-up time.

$$\text{logit } (\pi )= \beta_0 + \beta_1 \text{education}$$

  • $\begingroup$ Thank you very much for your insight $\endgroup$
    – tk001
    Jan 30, 2020 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.