How does NIMBLE handle a mean of zero in a Poisson distribution?

292 views
Skip to first unread message

Jacob Oram

unread,
Sep 13, 2023, 12:48:48 PM9/13/23
to nimble-users
Hi NIMBLE team,

I'm curious about how NIMBLE handles means of zero when modeling Poisson counts. For example, this often happens when we feed in a latent occupancy state into the mean to create a zero-inflated model. I've attached code for three toy examples. The first example is similar to how Poisson counts are often modeled conditional on occupancy. In the second example, I pretend that we "know" the z states so that the mean of the Poisson distribution is exactly zero (and the corresponding counts are as well). Both of these examples run well, but the third one breaks. In that example, I also assume the z states are known, but change the 5th row of the count data to contain non-zero values. I get the familiar warning that the log probability of those data nodes is -Inf (as expected).

So my question is: why does the the second example not break, since we have lambda = 0 for some observations? Presumably it is because the count is zero -- why does NIMBLE tolerate a mean of zero if the count is also zero, but not if the count is a positive value? Is there some small positive epsilon added to the mean under the hood when the count is zero?

Forgive me if this is due to some elementary math stat fact that I've forgotten, and thanks for your time.

Jacob
NIMBLE_dpois_example.R

Perry de Valpine

unread,
Sep 13, 2023, 1:08:44 PM9/13/23
to Jacob Oram, nimble-users
Hi Jacob,
This is a hasty reply, so just let me know if I've missed the boat on what you're asking.
A Poisson distribution with mean zero has probably 1 for count=0 and probably 0 for count > 0. E.g. dpois(0, 0) returns 1, dpois(1, 0) returns 0. On log scale these become 0 and -Inf, respectively.
Hence, you can have lambda (Poisson mean) of 0 if the count happens to be 0, and the resulting log probability will be 0. But if the count is not 0, then lambda=0 means you have impossible data, for which the probability is 0 and log probability is -Inf.
Does that make more sense?
Perry


--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/839cee16-7803-40a6-9e82-9c56d0315509n%40googlegroups.com.

Oram, Jacob

unread,
Sep 13, 2023, 3:41:34 PM9/13/23
to Perry de Valpine, nimble-users
Perry,

Thanks for the quick reply. That makes sense, and you didn't miss the boat at all -- I just failed to write down the full specification of the Poisson P.M.F., which makes it much harder to recognize that dpois(0,0) will return 1. Thanks again for your time!

Jacob

From: Perry de Valpine <pdeva...@berkeley.edu>
Sent: Wednesday, September 13, 2023 11:08 AM
To: Oram, Jacob <Jaco...@montana.edu>
Cc: nimble-users <nimble...@googlegroups.com>
Subject: Re: How does NIMBLE handle a mean of zero in a Poisson distribution?
 

**External Sender**

Reply all
Reply to author
Forward
0 new messages