INLA: simple slopes from interaction (BYM2 logistic) — lincomb/cov.fixed/sampling all failing

14 views
Skip to first unread message

Jared Palazza

unread,
Sep 13, 2025, 2:03:55 AM (7 days ago) Sep 13
to R-inla discussion group
Hello,

I’m fitting a Bayesian logistic regression in INLA with a BYM2 spatial random effect and an interaction between a continuous predictor (X) and a categorical moderator (Z). Epidemiologically, I need the stratum-specific effect of X within each level of Z (i.e., the “simple slope”). On the log-odds scale this is: 

simple slope in level zj​: βX ​+ βX:Zj​​, 

which I then exponentiate to report an odds ratio (OR) with a 95% credible interval (CrI).

Failed attempts:
1. lincomb at fit time
     I attempted to pass a linear combination to obtain directly from the fitted model. Despite matching coefficient names to summary.fixed, INLA returned: "lincomb ... has only zero entries. This is not allowed."
2. Post-hoc enabling of config/sampling.
I tried to add config=TRUE after fitting (so I could sample from the joint posterior of the fixed effects), but inla.rerun(...) doesn’t accept control.compute, so I couldn’t “upgrade” the object.

What’s the recommended, version-robust workflow in INLA to obtain the marginal of a linear combination of fixed effects (like ) when a BYM2 component is present?
Are there known quirks with lincomb for interaction coefficient names, and a canonical way to specify them?

Thank you,

Jared Palazza

Helpdesk (Haavard Rue)

unread,
Sep 14, 2025, 2:40:32 AM (6 days ago) Sep 14
to Jared Palazza, R-inla discussion group

as attached
> --
> 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/0c1c7d33-e701-4f7e-a595-fa1e1ac16df1n%40googlegroups.com
> .

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

Helpdesk (Haavard Rue)

unread,
Sep 14, 2025, 2:43:24 AM (6 days ago) Sep 14
to Jared Palazza, R-inla discussion group
For this, you would need to add the config=TRUE when you fit the model, as its
tell inla() to store intermediate results needed to do inla.posterior.sample()

On Fri, 2025-09-12 at 14:26 -0700, Jared Palazza wrote:
> 2. Post-hoc enabling of config/sampling.
> I tried to add config=TRUE after fitting (so I could sample from the joint
> posterior of the fixed effects), but inla.rerun(...) doesn’t accept
> control.compute, so I couldn’t “upgrade” the object.

--
Håvard Rue
he...@r-inla.org
Reply all
Reply to author
Forward
0 new messages