Open Access
2023 Scalable Bayesian computation for crossed and nested hierarchical models
Omiros Papaspiliopoulos, Timothée Stumpf-Fétizon, Giacomo Zanella
Author Affiliations +
Electron. J. Statist. 17(2): 3575-3612 (2023). DOI: 10.1214/23-EJS2172


We develop sampling algorithms to fit Bayesian hierarchical models, the computational complexity of which scales linearly with the number of observations and the number of parameters in the model. We focus on crossed random effect and nested multilevel models, which are used ubiquitously in applied sciences. The posterior dependence in both classes is sparse: in crossed random effects models it resembles a random graph, whereas in nested multilevel models it is tree-structured. For each class we identify a framework for scalable computation, building on previous work. Methods for crossed models are based on extensions of appropriately designed collapsed Gibbs samplers, where we introduce the idea of local centering; while methods for nested models are based on sparse linear algebra (SLA) and data augmentation. We provide a theoretical analysis of the proposed algorithms in some simplified settings, including a comparison with previously proposed methodologies and an average-case analysis based on random graph theory. Numerical experiments, including two challenging real data analyses on predicting electoral results and real estate prices, compare with off-the-shelf Hamiltonian Monte Carlo, displaying drastic improvement in performance. The code for replicating the experiments in the article and for implementing our methods can be found at and

Funding Statement

The third author acknowledges support from the European Research Council (ERC), through StG “PrSc-HDBayLe” grant ID 101076564.


The authors are most grateful to Jie Hao Kwa, whose master’s dissertation in 2018 yielded useful insights into sparse linear algebra methods for nested multilevel models, and Maximilian Müller, whose master’s dissertation in 2020 investigated sparse linear methods for crossed effect models. The first two authors would like to thank Jose Garcia-Montalvo for the collaboration on the applied projects that have motivated this work. The article has benefited from comments by Darren Wilkinson.


Download Citation

Omiros Papaspiliopoulos. Timothée Stumpf-Fétizon. Giacomo Zanella. "Scalable Bayesian computation for crossed and nested hierarchical models." Electron. J. Statist. 17 (2) 3575 - 3612, 2023.


Received: 1 December 2022; Published: 2023
First available in Project Euclid: 29 November 2023

Digital Object Identifier: 10.1214/23-EJS2172

Keywords: crossed random effects , Gibbs sampler , multilevel models , Polya-gamma , Random graphs , reparameterisation , sparse linear algebra

Vol.17 • No. 2 • 2023
Back to Top