Open osupplisson opened 1 year ago
Good question. In your case (multiple CAR terms) there is no theoretical reason for this. It is merely implementation at this point. In future versions, it may be possible to add multiple such terms but that requires some backwards compatibility breaking changes in parameter naming so it may have to wait until brms 3.0
Hi, first and foremost, thank you very much for your work on this amazing package! I hope the following enhancement request will seem relevant.
I was trying to include two CAR (BYM2) terms and the following errors showed up (brms version 2.19.6, R version 4.3.0, Windows), which is pretty self-explanatory: Error: Can only model one term per autocorrelation class.
Is there any theoretical reason for this restriction? I had a look at R-INLA and multiple structured varying effects are supported, so this might come from something else. Would this be a possible enhancement for a near-future version?
As a bit of context, I was trying to use multiple structured varying terms with the aim to perform an MRP analysis, following this paper: Yuxiang Gao. Lauren Kennedy. Daniel Simpson. Andrew Gelman. "Improving Multilevel Regression and Poststratification with Structured Priors." Bayesian Anal. 16 (3) 719 - 744, September 2021. https://doi.org/10.1214/20-BA1223.
My goal was to include (in addition to other terms) two CAR-BYM2: one accounting for the spatial structure of the data and another one accounting for a hypothetical structure for age classes (age classes a-1 and a being 'adjacent'). On top of that, I wanted to use this with a non-linear formula aiming to account for misclassification errors (INLA does not support that, as far as I am aware).
Best, Olivier
Ps: The error seems to be triggered by the following lines of code in the formula-ac function:
You will find below a code replicating the error: