Package: stochtree 0.4.4

Drew Herren

stochtree: 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) <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.

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], xgboost contributors [cph], treelite contributors [cph], Microsoft Corporation [cph], Niels Lohmann [cph], Daniel Lemire [cph], Victor Zverovich [cph]

stochtree_0.4.4.tar.gz
stochtree_0.4.4.tar.gz(r-4.7-arm64)stochtree_0.4.4.tar.gz(r-4.7-x86_64)stochtree_0.4.4.tar.gz(r-4.6-arm64)stochtree_0.4.4.tar.gz(r-4.6-x86_64)
stochtree_0.4.4.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
stochtree/json (API)
NEWS

# Install 'stochtree' in R:
install.packages('stochtree', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/stochastictree/stochtree/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library

On CRAN:

Conda:

cppopenmp

4.55 score 2 packages 168 scripts 680 downloads 69 exports 3 dependencies

Last updated from:41a16d6d0f. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK262
linux-devel-x86_64OK236
source / vignettesOK262
linux-release-arm64OK255
linux-release-x86_64OK258
wasm-releaseOK203

Exports:bartbcfcalibrateInverseGammaErrorVariancecomputeBARTPosteriorIntervalcomputeBCFPosteriorIntervalcomputeContrastBARTModelcomputeContrastBCFModelcomputeForestLeafIndicescomputeForestLeafVariancescomputeForestMaxLeafIndexcreateBARTModelFromCombinedJsoncreateBARTModelFromCombinedJsonStringcreateBARTModelFromJsoncreateBARTModelFromJsonFilecreateBARTModelFromJsonStringcreateBCFModelFromCombinedJsoncreateBCFModelFromCombinedJsonStringcreateBCFModelFromJsoncreateBCFModelFromJsonFilecreateBCFModelFromJsonStringcreateCppJsoncreateCppJsonFilecreateCppJsonStringcreateCppRNGcreateForestcreateForestDatasetcreateForestModelcreateForestModelConfigcreateForestSamplescreateGlobalModelConfigcreateOutcomecreatePreprocessorFromJsoncreatePreprocessorFromJsonStringcreateRandomEffectSamplescreateRandomEffectsDatasetcreateRandomEffectsModelcreateRandomEffectsTrackerextractParametergetRandomEffectSamplesloadForestContainerCombinedJsonloadForestContainerCombinedJsonStringloadForestContainerJsonloadRandomEffectSamplesCombinedJsonloadRandomEffectSamplesCombinedJsonStringloadRandomEffectSamplesJsonloadScalarJsonloadVectorJsonOutcomeModelpreprocessPredictionDatapreprocessTrainDataresetActiveForestresetForestModelresetRandomEffectsModelresetRandomEffectsTrackerrootResetRandomEffectsModelrootResetRandomEffectsTrackersample_without_replacementsampleBARTPosteriorPredictivesampleBCFPosteriorPredictivesampleGlobalErrorVarianceOneIterationsampleLeafVarianceOneIterationsaveBARTModelToJsonsaveBARTModelToJsonFilesaveBARTModelToJsonStringsaveBCFModelToJsonsaveBCFModelToJsonFilesaveBCFModelToJsonStringsavePreprocessorToJsonsavePreprocessorToJsonString

Dependencies:BHcpp11R6

Readme and manuals

Help Manual

Help pageTopics
stochtree: Stochastic Tree Ensembles (XBART and BART) for Supervised Learning and Causal Inferencestochtree-package stochtree
Run BART for Supervised Learningbart
BART Serialization RoutinesBARTSerialization createBARTModelFromCombinedJson createBARTModelFromCombinedJsonString createBARTModelFromJson createBARTModelFromJsonFile createBARTModelFromJsonString saveBARTModelToJson saveBARTModelToJsonFile saveBARTModelToJsonString
Run BCF for Causal Effect Estimationbcf
BCF Serialization RoutinesBCFSerialization createBCFModelFromCombinedJson createBCFModelFromCombinedJsonString createBCFModelFromJson createBCFModelFromJsonFile createBCFModelFromJsonString saveBCFModelToJson saveBCFModelToJsonFile saveBCFModelToJsonString
Calibrate Inverse Gamma PriorcalibrateInverseGammaErrorVariance
Compute BART Posterior Credible IntervalscomputeBARTPosteriorInterval
Compute BCF Posterior Credible IntervalscomputeBCFPosteriorInterval
Compute Contrast for BART ModelcomputeContrastBARTModel
Compute Contrast for BCF ModelcomputeContrastBCFModel
JSON C++ Object WrapperCppJson
Random Number Generator C++ WrapperCppRNG
Create CppRNG ObjectcreateCppRNG
Create Forest ObjectcreateForest
Create ForestDataset ObjectcreateForestDataset
Create ForestModel ObjectcreateForestModel
Create ForestModelConfig ObjectcreateForestModelConfig
Create ForestSamples ObjectcreateForestSamples
Create GlobalModelConfig ObjectcreateGlobalModelConfig
Create Outcome ObjectcreateOutcome
Create RandomEffectSamples ObjectcreateRandomEffectSamples
Create RandomEffectsDataset ObjectcreateRandomEffectsDataset
Create RandomEffectsModel ObjectcreateRandomEffectsModel
Create RandomEffectsTracker ObjectcreateRandomEffectsTracker
Data Preprocessing RoutinescreatePreprocessorFromJson createPreprocessorFromJsonString DataPreprocessing preprocessPredictionData preprocessTrainData savePreprocessorToJson savePreprocessorToJsonString
Extract Parameter Samples Generic FunctionextractParameter
Extract BART Parameter SamplesextractParameter.bartmodel
Extract BCF Parameter SamplesextractParameter.bcfmodel
Forest C++ WrapperForest
Forest Dataset C++ WrapperForestDataset
Forest Kernel Computation RoutinescomputeForestLeafIndices computeForestLeafVariances computeForestMaxLeafIndex ForestKernelComputation
Forest Model C++ WrapperForestModel
Forest Model Configuration ObjectForestModelConfig
Forest Container C++ WrapperForestSamples
Forest Container Serialization RoutinesForestSamplesSerialization loadForestContainerCombinedJson loadForestContainerCombinedJsonString loadForestContainerJson
Forest State Management RoutinesForestStateManagement resetActiveForest resetForestModel
Extract Random Effect Samples Generic FunctiongetRandomEffectSamples
Extract Random Effects Samples from BART ModelgetRandomEffectSamples.bartmodel
Extract Random Effect Samples from BCF ModelgetRandomEffectSamples.bcfmodel
Global Model Configuration ObjectGlobalModelConfig
JSON Creation RoutinescreateCppJson createCppJsonFile createCppJsonString JSONCreation
Load Scalar from JSONloadScalarJson
Load Vector from JSONloadVectorJson
Outcome Data C++ WrapperOutcome
Create a New Outcome Model ObjectOutcomeModel
Plot BART Model Fitplot.bartmodel
Plot BCF Modelplot.bcfmodel
Predict from a BART Modelpredict.bartmodel
Predict from BCF Modelpredict.bcfmodel
Print Summary of BART Modelprint.bartmodel
Print Summary of BCF Modelprint.bcfmodel
Summarize a ForestSamples Objectprint.ForestSamples
Summarize a RandomEffectSamples Objectprint.RandomEffectSamples
Random Effect Container C++ WrapperRandomEffectSamples
Random Effects Container Serialization RoutinesloadRandomEffectSamplesCombinedJson loadRandomEffectSamplesCombinedJsonString loadRandomEffectSamplesJson RandomEffectSamplesSerialization
Random Effects Dataset C++ WrapperRandomEffectsDataset
Random Effects Model C++ WrapperRandomEffectsModel
Random Effects State Management RoutinesRandomEffectStateManagement resetRandomEffectsModel resetRandomEffectsTracker rootResetRandomEffectsModel rootResetRandomEffectsTracker
Random Effects Tracker C++ WrapperRandomEffectsTracker
Sample Without Replacementsample_without_replacement
Sample BART Posterior PredictivesampleBARTPosteriorPredictive
Sample BCF Posterior PredictivesampleBCFPosteriorPredictive
Sample Global Error VariancesampleGlobalErrorVarianceOneIteration
Sample Leaf ScalesampleLeafVarianceOneIteration
Summarize BART Model Fit and Parameterssummary.bartmodel
Summarize BCF Modelsummary.bcfmodel