Model library Bayesian Additive Regression Trees (BART)
Statistical model reference

Bayesian Additive Regression Trees (BART)

Review when to use this method, its data requirements, implementation patterns, and interpretation guidance.

Description

Nonparametric Bayesian ensemble method that combines many weak learners (decision trees) through a sum-of-trees model. Automatically handles nonlinearities, interactions, and variable selection. Provides uncertainty estimates via posterior distributions over tree structures and leaf parameters.

Use Cases
  • nonlinear_relationships
  • automatic_feature_interactions
  • high-dimensional_data
  • missing_data_imputation
Requirements
  • Sample Size: small (n > 50), medium, large
  • Missing Data: none, random, handled_automatically
  • Data Distribution: any, nonparametric
  • Relationship Type: non_linear, interactive
Variable Types
Dependent Variables
  • continuous
  • binary
  • count
Independent Variables
  • continuous
  • categorical
  • mixed_types
Implementation
from pymc3 import BART

with pm.Model() as bart_model:
    # BART prior
    mu = BART('mu', X=X, Y=y, m=50)
    
    # Likelihood
    y_obs = pm.Normal('y_obs', mu=mu, observed=y)
    
    # Inference
    trace = pm.sample(2000, tune=1000)
Documentation
library(BART)

# For continuous y
fit <- wbart(x.train=X, y.train=y, nskip=500, ndpost=2000)

# For binary y
fit <- pbart(x.train=X, y.train=y)
Documentation
/* Not natively available in SPSS */
Documentation
/* Not natively available in base SAS */
Documentation
bart y x1 x2, iter(2000) burn(500)
Documentation
Synthetic Data Example

Simulated dataset with nonlinear effects and interactions

R Code for Data Generation and Analysis
set.seed(123)
n <- 500
x1 <- runif(n)
x2 <- rnorm(n)

# Nonlinear relationship with interaction
y <- 2*sin(pi*x1) + 0.5*x2^2 + x1*x2 + rnorm(n, sd=0.5)

df <- data.frame(y, x1, x2)
Copy this code into your R environment to generate synthetic data and perform analysis with this model.
Expected Analysis Results
Console Output
> summary(fit)
Call: wbart
Number of trees: 50

Variable selection proportions:
  x1   x2 
0.62 0.38 

Posterior mean RMSE: 0.51
95% credible interval for RMSE: [0.48, 0.54]
Visualizations
Plot 1
Plot 2
These results are from running the R code on synthetic data. Your actual results may vary depending on your data.
Interpretation Guide

Need help interpreting the results of your Bayesian Additive Regression Trees (BART) analysis? Our comprehensive interpretation guide explains:

  • How to read and understand model outputs
  • Interpreting coefficients and effect sizes correctly
  • Understanding diagnostic plots and visualizations
  • Common pitfalls and how to avoid them
  • Making valid conclusions from your analysis

Statistical assistant