Scaling Probabilities in Binomial Regression

32 views
Skip to first unread message

Damien Beecroft

unread,
Jan 24, 2026, 1:06:38 AM (12 days ago) Jan 24
to R-inla discussion group
Hello INLA Community,

I am trying to get the scale parameter to work for a binomial model, but am struggling with the implementation. Here is what I am trying.

```
n = 1000
a = 1
b = 1
z = rnorm(n)
eta = a + b*z
prob = exp(eta)/(1 + exp(eta))
q = 0.5 * runif(n) + 0.5
# q = 0.9
Ntrials = sample(0:10, size=n, replace=TRUE)
y = rbinom(n, size = Ntrials, prob = q*prob)
data = data.frame(y, z, Ntrials)

formula <- y ~ 1 + z
r = inla(formula,
         family="binomial",
         data=data,
         Ntrials=Ntrials,
         scale=q)  # THE IMPORTANT LINE
summary(r)
```

From the documentation of the binomial distribution this seems like it should be correct (link at bottom). However, the regression is totally wrong. I also tried "xbinomial" but that crashed.

Furthermore, the documentation for "scale" that shows up upon invoking `?inla` is the following:

scale    Fixed (optional) scale parameters of the precision for Gaussian and Student-T response models. Default value is rep(1, n.data).

From the results I am getting it seems that the description from `?inla` is correct and the binomial likelihood documentation is false. I also may be reading something wrong.

Thank you in advance!

Best,
Damien

Binomial Likelihood Documentation:
chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://inla.r-inla-download.org/r-inla.org/doc/likelihood/binomial.pdf

Damien Beecroft

unread,
Jan 26, 2026, 1:06:19 PM (9 days ago) Jan 26
to R-inla discussion group
Also, is there a way to scale probabilities for the cbinomial likelihood as well?

Best,
Damien

Helpdesk (Haavard Rue)

unread,
Jan 26, 2026, 1:40:38 PM (9 days ago) Jan 26
to Damien Beecroft, R-inla discussion group
There is currently no way to scale the probabilities using 'scale'. for the
binomial likelihood, which is documented here

inla.doc("^binomial$")

suppose we add a scaling, so that

p = scale * prob

where prob depends on the model (like linear predictor), and scale is a constant
> 0, then this would impose a constraint on 'prob' (ir scale > 1), and thereby a
constraint on the lin.predictor, leading to constrained high-dimensional
Gaussians.

it is possible to change the link function to have prob \in [a,b], but not
scaling it in general.

it would be possible to add it for 0 < scale < 1, which almost acts like a
thinning probability, or even let scale depend on covariates (see the model
'tpoisson'

there is a way to defined your own likelihood in 'c', see inla.doc("cloglike")
for which you can add your own scaling, but this would not prevent scale * prob
of going beyond 1 if scale > 1.

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, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/c8460aa2-e45f-4363-ad4f-6028a1875a58n%40googlegroups.com
> .

--
Håvard Rue
he...@r-inla.org

Håvard Rue

unread,
Jan 26, 2026, 1:45:50 PM (9 days ago) Jan 26
to Damien Beecroft, R-inla discussion group
its the same issue. the easy way out is to write your own likelihood function,
where you can do all this


On Mon, 2026-01-26 at 10:06 -0800, Damien Beecroft wrote:
> > chrome-
> > extension://efaidnbmnnnibpcajpcglclefindmkaj/https://inla.r-inla-download.or
> > g/r-inla.org/doc/likelihood/binomial.pdf
> --
> 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, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/c8460aa2-e45f-4363-ad4f-6028a1875a58n%40googlegroups.com
> .

--
Håvard Rue
hr...@r-inla.org
Message has been deleted

Damien Beecroft

unread,
Jan 26, 2026, 2:37:29 PM (9 days ago) Jan 26
to R-inla discussion group
Thank you for the response. The document invoked from `inla.doc("^binomial$")` is the same one I linked. If you look at the "Expert version" section it states there is a way to scale the probabilities of the binomial regression. So, it seems the binomial documentation is wrong. Also,  `inla.doc("cloglike")`  and  `inla.doc("^cloglike$")` do nothing. I think the correct command is ` vignette("rgeneric", package = "INLA")`. I will try to implement the likelihood function.

Best,
Damien

Finn Lindgren

unread,
Jan 26, 2026, 2:46:41 PM (9 days ago) Jan 26
to Damien Beecroft, R-inla discussion group
That “expert” part clearly says the scale option is only available in the xbinomial model.
(Whether it works for your case is a separate issue, but it’s clear that trying it with plain binomial is not supposed to work)
Finn

On 26 Jan 2026, at 19:37, Damien Beecroft <dob...@uw.edu> wrote:

Thank you for the response. The document invoked from `inla.doc("^binomial$")` is the same one I linked. If you look at the "Expert version" section it states there is a way to scale the probabilities of the binomial regression. So, it seems the binomial documentation is wrong. Also,  `inla.doc("cloglike")`  and  `inla.doc("^cloglike$")` do nothing. I think the correct command is ` vignette("rgeneric", package = "INLA")`. I will try to implement the likelihood function.
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.

Damien Beecroft

unread,
Jan 26, 2026, 3:32:54 PM (9 days ago) Jan 26
to R-inla discussion group
Hello Finn,

Thanks for the quick reply. When I tried xbinomial before it was always failing (even without the scale ooption) and I got confused. However, I noticed your example at the bottom of the binomial documentation and it helped me create a working example. Sorry for the confusion and thank you for the help!

Best,
Damien
Reply all
Reply to author
Forward
0 new messages