Non-integer counts for binomial model

80 views
Skip to first unread message

Jeff Eaton

unread,
Mar 29, 2020, 4:24:10 AM3/29/20
to R-inla discussion group
Hello,

Following a recent update to INLA, I started getting the following error message:

*** ERROR *** INLA.Data1: BINOMIAL likelihood is defined on integers, but y[4] = 1.16298220095

I traced this to an update in VERSION 20.01.25: "Added a check that discrete observations are indeed integers, like for Poisson, Binomial, etc"


We often use the binomial model to approximate the likelihood for survey weighted data (e.g. as outlined by Chen, Wakefield, Lumley: https://www.stat.washington.edu/sites/default/files/files/reports/2011/tr583.pdf)

I wanted to enquire the reason for this change, and whether it is possible for this to raise a warning rather than an error (as in glm())?

Many thanks,
Jeff

Helpdesk

unread,
Mar 29, 2020, 4:57:13 AM3/29/20
to Jeff Eaton, R-inla discussion group
Hi & thanks for your email.

To input non-integer values into the Biomial, can, yes, be seen an
error or not, depending on the situation. In most cases it is an user-
error, and for that reason its now raise an error.

With the binomial as

{n \chose y} p^y * (1-p)^(n-y)

its kind of obvious how to use a non-integer for p^y and (1-p)... for
the normalizing constant its not so clear (used for marginal
likelihood), should we use the Gamma function which generalize the
integer factorials? if not, how about runding to 'nearest integer',
using floor(),round() etc... its all these small details.

well, if there should be a 'binomial' for continous response, I'm happy
to add that one under a spesific own name, so it can defined properly
and the user can know exactly what is going on.

If you send me the details, I can add a 'xbinomial' today, similar to
inla.doc("xpoisson")

Best
H
> --
> 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
> .
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/f42a8824-06b6-497e-9326-7a6da85c7148%40googlegroups.com
> .
--
Håvard Rue
Helpdesk
he...@r-inla.org

Jeff Eaton

unread,
Mar 29, 2020, 6:18:39 AM3/29/20
to R-inla discussion group
Thank you for the very fast reply.

The common application for us with this is approximating a likelihood for weighted complex survey data. In this case both the effective events and the effective sample size could be non-integer.

The 'xbinomial' family solutions sounds good to me, thank you.

Yes, I hadn't considered the need for normalizing constant for the marginal likelihood calculation. My instinct would probably also be to use the gamma function to generalize, but I do not have much intuition about the consequences.  On a bit more of a search, I see that this question has also come up before on the listserv without conclusion: 


Since gsl_sf_lnchoose_e() takes unsigned int arguments, the previous behaviour presumably would have been to take the floor?

Thanks,
Jeff

Helpdesk

unread,
Mar 29, 2020, 4:40:58 PM3/29/20
to Jeff Eaton, R-inla discussion group

The new testing version of today have the xbinomial; see
inla.doc("xbinomial")

the normalizing constant is not correct hence marginal likelihood would
not 'make sense'.

H
> > r-inla-discussion...@googlegroups.com

Jeff Eaton

unread,
Apr 1, 2020, 1:14:52 PM4/1/20
to R-inla discussion group
Håvard,

Many thanks for this. I have just installed and successfully tested. 

Thanks,
Jeff
Reply all
Reply to author
Forward
0 new messages