Stochastic Tree Ensembles (XBART and BART) for Supervised Learning and Causal Inference

Flexible stochastic tree ensemble software. Robust implementations of Bayesian Additive Regression Trees (BART) (Chipman, George, McCulloch (2010) ) for supervised learning and Bayesian Causal Forests (BCF) (Hahn, Murray, Carvalho (2020) ) for causal inference. Enables model serialization and parallel sampling and provides a low-level interface for custom stochastic forest samplers. Includes the grow-from-root algorithm for accelerated forest sampling (He and Hahn (2021) ), a log-linear leaf model for forest-based heteroskedasticity (Murray (2020) ), and the cloglog BART model of Alam and Linero (2025) for ordinal outcomes.


stochtree R package

Software for building stochastic tree ensembles (i.e. BART, XBART) for supervised learning and causal inference.

Getting started

stochtree can be installed from CRAN via

install.packages("stochtree")

The development version of stochtree can be installed from github via

remotes::install_github("StochasticTree/stochtree", ref="r-dev")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("stochtree")

0.4.5 by Drew Herren, 3 months ago


https://stochtree.ai/, https://github.com/StochasticTree/stochtree


Report a bug at https://github.com/StochasticTree/stochtree/issues


Browse source code at https://github.com/cran/stochtree


Authors: Drew Herren [aut, cre] , Richard Hahn [aut] , Jared Murray [aut] , Carlos Carvalho [aut] , Jingyu He [aut] , Pedro Lima [ctb] , Entejar Alam [ctb] , stochtree contributors [cph] , Eigen contributors [cph] (C++ source uses the Eigen library for matrix operations , see inst/COPYRIGHTS) , xgboost contributors [cph] (C++ tree code and related operations include or are inspired by code from the xgboost library , see inst/COPYRIGHTS) , treelite contributors [cph] (C++ tree code and related operations include or are inspired by code from the treelite library , see inst/COPYRIGHTS) , Microsoft Corporation [cph] (C++ I/O and various project structure code include or are inspired by code from the LightGBM library , which is a copyright of Microsoft , see inst/COPYRIGHTS) , Niels Lohmann [cph] (C++ source uses the JSON for Modern C++ library for JSON operations , see inst/COPYRIGHTS) , Daniel Lemire [cph] (C++ source uses the fast_double_parser library internally , see inst/COPYRIGHTS) , Victor Zverovich [cph] (C++ source uses the fmt library internally , see inst/COPYRIGHTS)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports R6, stats

Suggests testthat

Linking to cpp11, BH

System requirements: C++17


Imported by BayesPocket.


See at CRAN