Compositional data (CoDa) play an important role in many fields such as ecology, geology, and biology. The most widely used modeling approaches are based on the Dirichlet and the logistic-normal formulation under Aitchison geometry. Recent developments in simplex geometry allow regression models to be expressed in terms of coordinates and their coefficients to be estimated. Once the model is projected into real space, a multivariate Gaussian regression can be employed. However, most existing methods focus on linear models, and there is a lack of flexible alternatives such as additive or spatial models, especially within a Bayesian framework and with practical implementation details. In this work, we present a geoadditive regression model for CoDa from a Bayesian perspective using the brms package in R. The model applies the isometric log-ratio (ilr) transformation and penalized splines to incorporate nonlinear effects. We also propose two new Bayesian goodness-of-fit measures for CoDa regression: BR-CoDa-R² and BM-CoDa-R², extending the Bayesian R² to the compositional setting. These measures, alongside WAIC, support the descriptive assessment of explained variability and complement model evaluation. The methodology is validated through simulation studies and applied to predict soil texture composition in the Basque Country. Results demonstrate good performance, interpretable spatial patterns, and reliable quantification of explained variability in compositional outcomes.
Key words
Bayesian inference; CoDa; Bayesian CoDa-R^2; Spatial modelling; Generalized additive models; penalized splines
Find here the accompanying code repository for the paper and attached in the article the Supplementary Information.