English

StochTree: BART-based modeling in R and Python

Computation 2026-02-23 v2

Abstract

stochtree is a C++ library for Bayesian tree ensemble models such as BART and Bayesian Causal Forests (BCF), as well as user-specified variations. Unlike previous BART packages, stochtree provides bindings to both R and Python for full interoperability. stochtree boasts a more comprehensive range of models relative to previous packages, including heteroskedastic forests, random effects, and treed linear models. Additionally, stochtree offers flexible handling of model fits: the ability to save model fits, reinitialize models from existing fits (facilitating improved model initialization heuristics), and pass fits between R and Python. On both platforms, stochtree exposes lower-level functionality, allowing users to specify models incorporating Bayesian tree ensembles without needing to modify C++ code. We illustrate the use of stochtree in three settings: i) straightfoward applications of existing models such as BART and BCF, ii) models that include more sophisticated components like heteroskedasticity and leaf-wise regression models, and iii) as a component of custom MCMC routines to fit nonstandard tree ensemble models.

Cite

@article{arxiv.2512.12051,
  title  = {StochTree: BART-based modeling in R and Python},
  author = {Andrew Herren and P. Richard Hahn and Jared Murray and Carlos Carvalho},
  journal= {arXiv preprint arXiv:2512.12051},
  year   = {2026}
}
R2 v1 2026-07-01T08:22:59.844Z