besag/iid, bym and bym2 especifications

753 views
Skip to first unread message

Fernanda Vallejos

unread,
Nov 4, 2023, 10:46:18 AM11/4/23
to R-inla discussion group

Hi everyone!
I am adjusting a spatial model, specifically a BYM model, and i am curious about the differences between using the following specifications "besag and iid," "bym," and "bym2." I have fitted the same model with these different specifications, and I have observed variations in the coefficients. I am unsure about how to interpret these differences and why they are occurring. here's an example with the london suicides dataset:


"Bym2"
formula <- y ~ 1 + f(ID, model="bym2", graph=LDN.adj)
mod <- inla(formula,family="poisson",data=data,E=E,
            control.compute=list(return.marginals.predictor=TRUE,dic=TRUE,waic=TRUE,cpo=TRUE))
summary(mod)

"bym"
formula2 <- y ~ 1 + f(ID, model="bym", graph=LDN.adj)
mod2 <- inla(formula2,family="poisson",data=data,E=E,
            control.compute=list(return.marginals.predictor=TRUE,dic=TRUE,waic=TRUE,cpo=TRUE))
summary(mod2)


"besag/iid"

formula3 <- y ~ 1 + f(ID, model="besag", graph=LDN.adj)+f(ID2, model = "iid")
mod3 <- inla(formula3,family="poisson",data=data,E=E,
            control.compute=list(return.marginals.predictor=TRUE,dic=TRUE,waic=TRUE,cpo=TRUE))
summary(mod3)


Results for the 3 models:
> mod$summary.hyperpar
                       mean        sd 0.025quant   0.5quant 0.975quant mode
Precision for ID 17.9088117 5.3525995 9.48887868 17.2166760 30.3819795   NA
Phi for ID        0.4669166 0.2406966 0.07094782  0.4545469  0.9099025   NA

> mod2$summary.hyperpar
                                         mean        sd 0.025quant 0.5quant 0.975quant mode
Precision for ID (iid component)     54.24477 31.100650  16.249344 47.06699  141.95641   NA
Precision for ID (spatial component) 13.55155  7.260619   4.126922 11.94525   33.25437   NA

> mod3$summary.hyperpar
                      mean       sd 0.025quant 0.5quant 0.975quant mode
Precision for ID  18.87020 13.61775   4.832256 15.16596   54.78097   NA
Precision for ID2 54.23518 33.22181  17.146640 45.70741  141.30057   NA



I understand that these differences in coefficients are likely related to the properties of the distribution used in each specification, but I'm not entirely certain.
I hope that somebody can help me!! thank you so much

Helpdesk (Haavard Rue)

unread,
Nov 4, 2023, 1:48:30 PM11/4/23
to Fernanda Vallejos, R-inla discussion group

In short, and almost presice:

besag+iid (with argument scale.model=TRUE!!!!!), this is the classic
version but done right, as it account for disconnected graphs and treat
nodes with no neighbours right. no good default priors.

bym: works with the sum and the spatial part, hence simpler to specify
but with same general comments as for besag+iid

bym2: this is 'bym' done right, with good priors and better
parameterisation: overall precision and fraction of precision explained
by one part. the prior for the faction depends on the graph and is
computed automatically. This one is developed in the paper

@Article{art585,
author = {A. Riebler and S. H. S{\o}rbye and D. Simpson and H.
Rue},
title = {An intuitive {B}ayesian spatial model for disease
mapping that accounts for scaling},
journal = {Statistical Methods in Medical Research},
keywords = {year2016,my.own,my.cv},
year = 2016,
volume = 25,
number = 4,
pages = {1145-1165}
> --
> 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/dc6da1be-6a67-4e5d-8f26-027a7412f0f9n%40googlegroups.com
> .

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

Fernanda Vallejos

unread,
Nov 5, 2023, 2:06:40 PM11/5/23
to R-inla discussion group
Thank you so much!!!
Reply all
Reply to author
Forward
0 new messages