BYM2 INLA Penalised complexity priors

Hello everyone,

I recently started exploring the use of rstan. I have a BYM2 model adjusted with 1 covariate. I have fit the model using both INLA and rstan, and I’ve noticed that while the coefficients beta0 and beta1 are very similar, the random effects are not. I’ve attempted to convert between theta and phi to see if it’s related, but they are quite different. I suspect this discrepancy might be due to the hyperpriors. In INLA, I’m using the PC Priors :
hyper = list (phi = list (
prior = “pc”,
param = c(0.5 , 2/3) ,
initial = 3) ,
prec = list (
prior = "pc. prec ",
param = c (0.2 /0.31 , 0.01) ,
initial = 5)))

which I believe is the correct way to specify the model. However, I’m unsure of how to translate this hyperprior used in INLA to rstan. I’ve used the BYM2.stan example file as a model, and I have the Scotland data ready as a reference for fitting. Could you please help?

Hi!
Well, I’m not much familiar with spatial models for areal (lattice) data, however, I’ve read about some discrepancies in the same R-INLA for these types of models when you are using default priors or PC priors.
For example, in this paper (https://journals.sagepub.com/doi/full/10.1177/0962280216660421?journalCode=smma) the authors propose a default prior for Poisson data, but I assume that you could need another type of scaling for others likelihood functions. In R-INLA you have an argument (If I’m not wrong, \texttt{scale.model}, which by default is TRUE). So, one idea could be figure out what is doing that argument internally in R-INLA and try to translate it to Stan.

1 Like

You’re in luck. @mitzimorris wrote a detailed tutorial for the BYM2 model:

https://mc-stan.org/users/documentation/case-studies/icar_stan.html

And of course, it starts with the Scottish cancer data set before scaling up to bigger models and models with disconnected components. Mitzi’s going to be at GeoMed this year giving a tutorial on Stan for spatial models:

2 Likes

Thank you very much for responding!!I have already reviewed the suggestions provided in both responses. I think that because I’m so new to using RStan, I can’t see the connection between what’s used in INLA as a PC prior. Essentially, what I want is to fit the same model with the same specifications using both methods.