spStack fits Bayesian hierarchical spatial process models for point-referenced Gaussian, Poisson, binomial, and binary data using stacking of predictive densities. It is written in C++ with calls to Fortran routines for optimized linear algebra operations.
The package samples from analytically available posterior distributions conditional upon candidate values of the spatial process parameters, then assimilates inference from these individual posterior distributions using Bayesian predictive stacking. This algorithm is highly parallelizable and hence much faster than traditional Markov chain Monte Carlo algorithms, while delivering competitive predictive performance. See (Pan & Banerjee, 2024) and (Pan et al., 2025) for details.
Core functions include:
spLMstack(): Bayesian spatial linear model using predictive stacking
spGLMstack(): Bayesian spatial generalized linear model using predictive stacking
stvcGLMstack(): Bayesian spatially-temporally varying coefficients generalized linear model using predictive stacking
recoverGLMscale(): Recover posterior samples of scale parameters of spatial/spatial-temporal generalized linear models
posteriorPredict(): Prediction of latent process at new spatial or temporal locations
Additional matrix algebra utilities, implemented in C++ and exposed through R wrappers, including functionality not available through standard BLAS routines:
Analysing non-Gaussian spatial-temporal data typically requires introducing spatial dependence in generalised linear models through the link function of an exponential family distribution. However, unlike in Gaussian likelihoods, inference is considerably encumbered by the inability to analytically integrate out the random effects and reduce the dimension of the parameter space. We devise an approach that obviates these issues by exploiting generalised conjugate multivariate distribution theory for exponential families, which enables exact sampling from analytically available posterior distributions conditional upon some fixed process parameters. We evaluate inferential performance on simulated data, compare with fully Bayesian inference using Markov chain Monte Carlo and apply our proposed method to analyse spatially-temporally referenced avian count data from the North American Breeding Bird Survey database.
@article{pan2025_stacking_ba,title={Bayesian Inference for Spatial-Temporal Non-{G}aussian Data Using Predictive Stacking},author={Pan, Soumyakanti and Zhang, Lu and Bradley, Jonathan R. and Banerjee, Sudipto},journal={Bayesian Analysis},publisher={International Society for Bayesian Analysis},year={2025},doi={10.1214/25-BA1582},pubstate={In Press},show={true},remark={Selected as one of four papers for presentation at the "Selected Papers from Bayesian Analysis" session at ISBA 2026 World Meeting, Nagoya, Japan.},highlight={true}}
2024
Preprint
spStack: Practical Bayesian Geostatistics Using Predictive Stacking in R
Statistical modeling and analysis for spatially oriented point-referenced outcomes play a crucial role in diverse scientific applications such as earth and environmental sciences, ecology, epidemiology, and economics. In this article, we introduce the R package spStack that delivers fast Bayesian inference for a class of geostatistical models, where we obviate weak identifiability issues in spatial process parameters by sampling from analytically available posterior distributions conditional upon candidate values of the spatial process parameters and, subsequently, assimilate inference from these individual posterior distributions using Bayesian predictive stacking. Our proposed algorithm is executable in parallel, drastically improving runtime over traditional MCMC.
@misc{pan2024spstack,title={spStack: Practical {B}ayesian Geostatistics Using Predictive Stacking in {R}},author={Pan, Soumyakanti and Banerjee, Sudipto},year={2024},cran={https://CRAN.R-project.org/package=spStack},show={true}}