Skip to content

stochtree

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

v0.4.5 · Jun 30, 2026 · MIT + file LICENSE

Description

Flexible stochastic tree ensemble software. Robust implementations of Bayesian Additive Regression Trees (BART) (Chipman, George, McCulloch (2010) <doi:10.1214/09-AOAS285>) for supervised learning and Bayesian Causal Forests (BCF) (Hahn, Murray, Carvalho (2020) <doi:10.1214/19-BA1195>) 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) <doi:10.1080/01621459.2021.1942012>), a log-linear leaf model for forest-based heteroskedasticity (Murray (2020) <doi:10.1080/01621459.2020.1813587>), and the cloglog BART model of Alam and Linero (2025) <doi:10.48550/arXiv.2502.00606> for ordinal outcomes.

Downloads

CRAN

687

Last 30 days

4866th

2.1K

Last 90 days

7.3K

Last year

Trend: +3.2% (30d vs prior 30d)

r2u CRAN

33

Last 30 days

149

Last 90 days

520

Last year

Trend: -37.7% (30d vs prior 30d)

autoCRAN

4

Last 7 days

18

Last 30 days

3

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

13 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 12 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Apr 25, 2026
NOTE 12 OK · 2 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026
NOTE r-oldrel-macos-arm64

installed package size

installed size is 34.9Mb
  sub-directories of 1Mb or more:
    libs  33.7Mb
NOTE r-oldrel-macos-x86_64

installed package size

installed size is 35.7Mb
  sub-directories of 1Mb or more:
    libs  34.4Mb

Code

Structure

Lines of code

238,440

Files

485

Compiled share

84.7%

Has compiled src

Yes

Language breakdown

R 19,858 (8.3%)C/C++/src 201,949 (84.7%)Tests 8,961 (3.8%)Docs 7,672 (3.2%)

API

Exported functions

69

Internal functions

270

Recent export changes

v0.4.0+9 OutcomeModel, computeBARTPosteriorInterval, computeBCFPosteriorInterval +6 more  −8 compute_bart_posterior_interval, compute_bcf_posterior_interval, compute_contrast_bart_model 5 more

Testing & CI

Has tests

Yes

Test-to-code ratio

0.45

testthat edition

3

CI present

No

CI type

[]

PR gated

No

Docs

Return-value doc rate

100%

\dontrun example ratio

0%

Roxygen coverage

100%

Has pkgdown

No

NEWS present

Yes

Health & Security signals

Informational signals; not verdicts.

on.exit coverage

Unsafe pattern score

0

Dep constraint coverage

0%

Secret pattern count

0

Bundled 3rd-party code

2 items

Portability & License

Min R version

System requirements

1

C++ standard

License

MIT + file LICENSE

License flags

SPDX valid, OSI approved

History

Versions

10

First release

2025-02-07

Latest release

2026-06-30

Avg cadence

22 days

Cold removal rate

100%

Dep drift

0

LOC over versions

v0.1.0: 218,256 LOCv0.1.1: 218,330 LOCv0.2.0: 228,733 LOCv0.2.1: 229,832 LOCv0.3.0: 232,222 LOCv0.3.1: 232,631 LOCv0.4.0: 235,342 LOCv0.4.2: 237,790 LOCv0.4.4: 238,410 LOCv0.4.5: 238,440 LOC

Per-file churn detail lives in the source pipeline: https://github.com/r-observatory/cran-code-metrics.

Reverse Dependencies (1)

imports

Dependency Network

Dependencies Reverse dependencies R6 BayesPocket stochtree

Version History

11 tracked
updated 0.4.5 ← 0.4.4 diff Jun 30, 2026
updated 0.4.4 ← 0.4.2 diff Jun 8, 2026
updated 0.4.2 ← 0.4.0 diff Apr 28, 2026
new 0.4.0 Mar 10, 2026
updated 0.4.0 ← 0.3.1 diff Mar 5, 2026
updated 0.3.1 ← 0.3.0 diff Feb 11, 2026
updated 0.3.0 ← 0.2.1 diff Jan 27, 2026
updated 0.2.1 ← 0.2.0 diff Dec 10, 2025
updated 0.2.0 ← 0.1.1 diff Nov 21, 2025
updated 0.1.1 ← 0.1.0 diff Feb 7, 2025
new 0.1.0 Feb 6, 2025