Skip to content

stochtree

0.4.5Package record

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

1packages dependsuggested by 1
6.9Kdownloads / year
64.3%test coverage
13/13flavors OK

Overview

About

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.

Changes in 0.4.5

Bug Fixes

  • Fix IndexError when sampling a mean-only Python BART model with categorical covariates; the excluded-variable weight zero-out is now guarded by the forest-inclusion flags, matching the R implementation #411
  • Fix ordinal class prediction bug in R BART #399

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 11.1 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK12 OK2026-04-25
  • NOTE12 OK, 2 NOTE2026-03-10
Advisories

none known

Documentation

In release 0.4.5
READMEYes · 40 wordsVignettesNoNEWSYes · 100% structured · mentions 0.4.5Citation fileNoWebsiteYes
Help pages
66includes a package overview page
Examples that run
100%44 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

6.9K
CRAN downloads in the past year
Rank #4,668 · ~19/day · ~578/mo
Daily download trend is not available in this view yet.
57230 days
1.8K90 days
6.9K1 year
Compare downloads with other packages →
Also on505 r2u4 autocran

Repository

77Stars
19Forks
18Open issues
0Open PRs
16Releases
1,445Commits
9Commit identities
decision-treesmachine-learningtree-ensemblesbartbayesian-methodsprobabilistic-modelsbayesian-machine-learninggradient-boosted-trees
1,445 commits · Last activity 2026-10-05 · 0% stars, 30d · Default branch at 0.4.6.9000, ahead of CRAN 0.4.5 (checked 2026-10-25)
Responsiveness
How these are sampled
PRs merged (all time)
95%
Median days to close, 50 most recently updated closed issues
14
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2025-10-24 · 582026-07-18 · 77
PracticesBeta

9 development-tooling and community-health practices detected across 7 families in the upstream repository

Checks run against github.com/stochastictree/stochtree on 2026-10-25.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (1)
Issue templates
Docs source (1)
pkgdown
Reproducibility and dev environment (1)
Dev Container
Show all practicesHide 3 practices
CRAN release process (1)
cran-comments.md
Lint, format, editor (1)
Air
Git structural (2)
.gitattributesSubmodules
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-03-10
    Pull request it wrote: opened by a project member
    Commits: at least 27 crediting it in the message
Models named in its commits
  • Claude Sonnet 4.619 commits · Mar to May 2026
  • Claude Opus 4.84 commits · Jun to Jul 2026
  • Claude Opus 5.54 commits · Oct 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
4 external dependencies (excludes base and recommended)

Installing stochtree adds 3 packages (0 with compiled code, 14 MB of source tarballs). Heaviest: BH 14 MB, cpp11 298 KB, R6 63 KB.

Depends (0)
none
Imports (2)
R6stats
LinkingTo (2)
Suggests (1)
Enhances (0)
none
Reverse dependencies
1direct
0indirect
Imports 1
Suggested by 1
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

People & History

People (15)
Author, Maintainer since 0.1.0 (2025)
Author
Contributor · added in 0.4.0
Contributor
Copyright holder
C++ I/O and various project structure code include or are inspired by code from the LightGBM library, which is a…
Copyright holder
C++ source uses the fast_double_parser library internally, see inst/COPYRIGHTS
Copyright holder
C++ source uses the JSON for Modern C++ library for JSON operations, see inst/COPYRIGHTS
Copyright holder
C++ source uses the fmt library internally, see inst/COPYRIGHTS
Copyright holder
C++ source uses the Eigen library for matrix operations, see inst/COPYRIGHTS
Copyright holder
Copyright holder
C++ tree code and related operations include or are inspired by code from the treelite library, see inst/COPYRIGHTS
Copyright holder
C++ tree code and related operations include or are inspired by code from the xgboost library, see inst/COPYRIGHTS
Releases (10)

Pick two releases to compare their code metrics.

  • 0.4.5Latest
    record
    2026-06-30 · current release · diff ↗
  • 0.4.4
    record
    2026-06-08 · diff ↗
  • 0.4.2
    record
    2026-04-28 · diff ↗
  • R
    R 4.6.0 released · 2026-04-24
  • 0.4.0
    record
    2026-03-06 · diff ↗ ·
    removed 8 exports
    compute_bart_posterior_interval, compute_bcf_posterior_interval, compute_contrast_bart_model, compute_contrast_bcf_model, convertPreprocessorToJson, extract_parameter, sample_bart_posterior_predictive, sample_bcf_posterior_predictive
    added 9 exports
    OutcomeModel, computeBARTPosteriorInterval, computeBCFPosteriorInterval, computeContrastBARTModel, computeContrastBCFModel, extractParameter, sampleBARTPosteriorPredictive, sampleBCFPosteriorPredictive, savePreprocessorToJson
  • 0.3.1
    record
    2026-02-12 · diff ↗
  • 0.3.0
    record
    2026-01-28 · diff ↗ ·
    removed 3 exports
    expand_dims_1d, expand_dims_2d, expand_dims_2d_diag
    added 1 export
    extract_parameter
  • 0.2.1
    record
    2025-12-11 · diff ↗
  • 0.2.0
    record
    2025-11-22 · diff ↗ ·
    added 10 exports
    compute_bart_posterior_interval, compute_bcf_posterior_interval, compute_contrast_bart_model, compute_contrast_bcf_model, expand_dims_1d, expand_dims_2d, expand_dims_2d_diag, sample_bart_posterior_predictive, sample_bcf_posterior_predictive, sample_without_replacement
  • R
    R 4.5.0 released · 2025-04-11
  • 0.1.1
    record
    2025-02-08 · diff ↗
  • 0.1.0
    record
    2025-02-07
  • R
    R 4.4.0 released · 2024-04-24

Package metadata

First published
2025-02-07
Total releases
10 / 1 yrs
License
MIT + file LICENSE OSI
Copyright
Copyright details for stochtree's C++ dependencies, which are vendored along with the core stochtree source code, are detailed in inst/COPYRIGHTS
Download size
1.6 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("stochtree")
Herren, D., Alam, E., Carvalho, C., Corporation, M., Hahn, R., He, J., Lemire, D., Lima, P., Lohmann, N., Murray, J., Zverovich, V., contributors, E., contributors, s., contributors, t., & contributors, x. (2026). stochtree: Stochastic Tree Ensembles (XBART and BART) for Supervised Learning and Causal Inference (Version 0.4.5) [Computer software]. https://doi.org/10.32614/CRAN.package.stochtree

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for stochtree version 0.4.5 [Data set]. HJJB, LLC. Data release v2026-10-26. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy