Learn R Programming

bartXViz (version 1.0.8)

Visualization of BART and BARP using SHAP

Description

Complex machine learning models are often difficult to interpret. Shapley values serve as a powerful tool to understand and explain why a model makes a particular prediction. This package computes variable contributions using permutation-based Shapley values for Bayesian Additive Regression Trees (BART) and its extension with Post-Stratification (BARP). The permutation-based SHAP method proposed by Strumbel and Kononenko (2014) is grounded in data obtained via MCMC sampling. Similar to the BART model introduced by Chipman, George, and McCulloch (2010) , this package leverages Bayesian posterior samples generated during model estimation, allowing variable contributions to be computed without requiring additional sampling. The BART model is designed to work with the following R packages: 'BART' , 'bartMachine' , and 'dbarts' . For XGBoost and baseline adjustments, the approach by Lundberg et al. (2020) is also considered. The BARP model proposed by Bisbee (2019) was implemented with reference to and is designed to work with modified functions based on that implementation. BARP extends post-stratification by computing variable contributions within each stratum defined by stratifying variables. The resulting Shapley values are visualized through both global and local explanation methods.

Copy Link

Version

Install

install.packages('bartXViz')

Monthly Downloads

458

Version

1.0.8

License

GPL (>= 2)

Maintainer

Dong-eun Lee

Last Published

July 28th, 2025

Functions in bartXViz (1.0.8)

svy

Survey Data on Support for Gay Marriage (2006)
Explain.bartMachine

Approximate Shapley Values Computed from a BART Model Fitted using bartMachine
decision_plot

Decision Plot
Explain.wbart

Approximate Shapley Values Computed from a BART Model Fitted using wbart or gbart
cces_30_df

Survey Data on Public Opinion about Abortion Coverage in Insurance Plans(2018)
census06

Census-Based Population Proportions for Covariate Bins (2006)
barps

Bayesian Additive Regression Trees with Post-Stratification (BARP)
Explain

Approximate Shapley Values
one_hot

One Hot Encode
Explain.bart

Approximate Shapley Values Computed from a BART Model Fitted using bart
Explain.barp

Approximate Shapley Values Computed from the BARP Model
waterfall_plot

Waterfall Plot
plot.Explainbarp

Visualization of Shapley Values from the BARP Model
plot.Explain

A Function for Visualizing the Shapley Values
plot.ExplainBART

A Function for Visualizing the Shapley Values of BART Models
plot.ExplainbartMachine

A Function for Visualizing the Shapley Values of BART Models
poststrat_30

Post-Stratification Table of 2014-2018 American Community Survey (ACS)