# Zero-inflated Poisson BYM model

18 views

### pstiles

May 16, 2022, 5:28:18 AMMay 16
to R-inla discussion group
Hello INLA group,

I have been testing some comparisons between a Poisson and a zero-inflated Poisson for aggregated spatial data using a BYM model. When I plot the fitted values on the map from these models, the Poisson looks sensible based on what I know of where the cases occurred, but fitted values from the ZIP seem to be the inverse of what I would expect. Is there an additional step I need to do in order to have the correct interpretation of the ZIP model? I am also wondering how the two models can be compared in terms of which is better-fitting? Thank you for your help!

Best,
Pascale

### Elias T. Krainski

May 16, 2022, 7:01:03 AMMay 16
to R-inla discussion group
Hi,

Before trying to understand what is wrong with the code (unfortunately we don't have to provide better help) I always check the possibility of not needing the ZIP and use the Poisson. The key point is that marginally excess of zeroes does not always require ZIP.

There are several ways to compare goodness-of-fit. I prefer to consider the negated sum of the log CPO.

See the simple Poisson regression example bellow

library(INLA)

set.seed(1)
n <- 30
dataset <- list(x = rexp(n, 1))
dataset\$y <- rpois(n, exp(1 -x))

table(dataset\$y)
n*dpois(0:5, mean(dataset\$y)) ### if iid

result1 <- inla(y ~ x, 'poisson',
data=dataset,
control.compute=list(cpo=TRUE))
result2 <- inla(y ~ x, 'zeroinflatedpoisson0',
data=dataset,
control.compute=list(cpo=TRUE))
result3 <- inla(y ~ x, 'zeroinflatedpoisson1',
data=dataset,
control.compute=list(cpo=TRUE))

### check if fail
c(sum(result1\$cpo\$fail>0),
sum(result2\$cpo\$fail>0),
sum(result3\$cpo\$fail>0))

### negated sum of CPO
c(-sum(log(result1\$cpo\$cpo)),
-sum(log(result2\$cpo\$cpo)),
-sum(log(result3\$cpo\$cpo)))

Elias

--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.