Component-specific posterior variance in non-connected INLA graphs

7 views
Skip to first unread message

Pauline Pouchin

unread,
Feb 23, 2026, 11:22:23 AM (2 days ago) Feb 23
to R-inla discussion group

Dear R-INLA community ,

I am conducting a spatio-temporal study of lung cancer incidence across several French departments and I aim to quantify the proportion of geographical variability explained by social deprivation.

To do so, I compute the following index:

where  and  are the posterior variances of the spatial component in a model without covariates and a model including social deprivation, respectively (with ).

I am using a non-connected spatial graph in R-INLA with the option adjust.for.con.comp = TRUE. My objective is to compute the proportion of explained spatial variability separately for each group of connected departments. I was therefore wondering whether it is possible to obtain these posterior variances by connected component, in order to compute the index for each subgraph. More specifically, does INLA internally compute or make available such component-specific variances when this option is enabled?

Thank you very much for your help.

Kind regards,

Pauline Pouchin

Helpdesk (Haavard Rue)

unread,
Feb 23, 2026, 9:42:29 PM (2 days ago) Feb 23
to Pauline Pouchin, R-inla discussion group

This can be computed, more a matter of details

It is easier to compute this (var.b - var.a) / var.a for each node of the graph,
and then it could be averaged for whatever subgraph you're after. Or just plot
the node-wise value.

if var.a var.b refer to the hyperparmeters then they would be the same, ie a
constant, for whatever subgraph

I added an example, please check and get back to me

Best
Havard





On Mon, 2026-02-23 at 05:50 -0800, Pauline Pouchin wrote:
> Dear R-INLA community ,
> I am conducting a spatio-temporal study of lung cancer incidence across
> several French departments and I aim to quantify the proportion of
> geographical variability explained by social deprivation.
> To do so, I compute the following index:
> R=(σ²b-​σ²a​)/
> σ²a
> ​​,
> where σ²b​and σ²a​are the posterior variances of the spatial component Ui​+Vi​
> in a model without covariates and a model including social deprivation,
> respectively (with σ²=1/precision).
> I am using a non-connected spatial graph in R-INLA with the option
> adjust.for.con.comp = TRUE. My objective is to compute the proportion of
> explained spatial variability separately for each group of connected
> departments. I was therefore wondering whether it is possible to obtain these
> posterior variances by connected component, in order to compute the index R
> for each subgraph. More specifically, does INLA internally compute or make
> available such component-specific variances when this option is enabled?
> Thank you very much for your help.
> Kind regards,
> Pauline Pouchin
> --
> 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/0bfd68a2-c5b8-467a-9e24-ed22837f6685n%40googlegroups.com
> .

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

Pauline Pouchin

unread,
5:36 AM (7 hours ago) 5:36 AM
to R-inla discussion group

Dear Havard,

Thank you very much for your reply and for the example, this is very helpful.

Just to clarify my setting: my spatial unit is the IRIS, and the BYM2 spatial effect is defined at the IRIS level using a (possibly non-connected) IRIS adjacency graph. I estimate relative risks at the IRIS level. I am able to identify which departments are connected (or not) in the graph, and based on this, I constructed a region variable corresponding to one department or to a group of connected departments. In total, this results in 7 connected components (regions).

What I am ultimately interested in is the "variance of IRIS-level risks" within each connected component, and how much of this spatial variability is explained by social deprivation, separately for each component.

Following your suggestion, I understand that the most appropriate approach is to compute the quantity

node-wise (i.e. at the IRIS level), using the posterior marginal variances of the spatial component, and then aggregate (e.g. average) these values over the IRIS belonging to each connected component (subgraph / “region”).

I was initially wondering whether adding an additional random effect at a higher level (one region = one department or one connected group of departments) could allow me to directly extract a within-region spatial variance. Concretely, this would correspond to:

- a BYM2 spatial effect at the IRIS level, and

- an iid random effect at the “region” (connected component) level,

as in the following code:

formula <- O ~
f(ID.space, model = "bym2", graph = IRIS.adj, hyper = list(prec = hyper_pc, phi = phi_prior), scale.model = TRUE) + # IRIS area effect
f(region_id, model = "iid", hyper = hyper.iid) + # Region effect (connected departments)
f(ID.space.time, model = "iid", hyper = hyper.iid) +
f(ID.time1, model = "iid", hyper = hyper.iid) +
f(ID.time3, model = "rw2", hyper = hyper.iid)

model <- inla(
formula = formula,
family = "poisson",
data = data,
E = E
)

Please let me know if this interpretation is correct, and what you think about adding such a random effect. 

Many thanks again for your help.

Best regards,
Pauline Pouchin

Reply all
Reply to author
Forward
0 new messages