Package: bartisan 0.1.0

Noah Greifer

bartisan: Generalized Bayesian Additive Regression Trees

Fits Bayesian additive regression trees (BART) models for likelihoods outside the conditionally conjugate Gaussian case, using the Laplace-approximation reversible-jump sampler of Linero (2025) <doi:10.1080/01621459.2024.2337156>. Supported response families include Gaussian, binomial, Poisson, negative binomial, gamma, beta, ordered beta, ordinal (cumulative link), multinomial, zero-inflated counts, a Tweedie compound Poisson for a non-negative response with a point mass at zero, accelerated failure time and proportional hazards models for right-censored survival data, location-scale regression, and a Dirichlet process mixture for the error distribution. Decision rules may be hard, as in standard BART, or soft, as in the SoftBart model of Linero and Yang (2018) <doi:10.1111/rssb.12293>, which yields smoother fits. The interface follows that of glm(), so that a model is specified with a formula, a data frame, and a family.

Authors:Noah Greifer [aut, cre, cph], Antonio R. Linero [ctb, cph]

bartisan_0.1.0.tar.gz
bartisan_0.1.0.zip(r-4.7-x86_64)bartisan_0.1.0.zip(r-4.7-arm64)bartisan_0.1.0.zip(r-4.6-x86_64)bartisan_0.1.0.zip(r-4.6-arm64)
bartisan_0.1.0.tar.gz(r-4.7-arm64)bartisan_0.1.0.tar.gz(r-4.7-x86_64)bartisan_0.1.0.tar.gz(r-4.6-arm64)bartisan_0.1.0.tar.gz(r-4.6-x86_64)
bartisan_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
bartisan/json (API)

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

Bug tracker:https://github.com/ngreifer/bartisan/issues

Pkgdown/docs site:https://ngreifer.github.io

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:
  • rhc - Right heart catheterization in critically ill patients

On CRAN:

Conda:

openblascpp

3.74 score 26 exports 25 dependencies

Last updated from:c8e7b6d230. Checks:10 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK282
linux-devel-x86_64OK345
source / vignettesOK390
linux-release-arm64OK275
linux-release-x86_64OK343
windows-devel-arm64OK469
windows-devel-x86_64OK456
windows-release-arm64OK405
windows-release-x86_64OK282
wasm-releaseOK167

Exports:bartisanbartisan_controlbcfBetacustom_familydiagnosedpmdpm_afterror_densityestimate_effectGamma_lsgaussian_lsloglogistic_aftlognormal_aftmultinomialnegbinordbetaordinalpartial_dependencephtweedievariable_importancevcweibull_aftzi_negbinzi_poisson

Dependencies:argclicpp11farverggplot2gluegtableisobandlabelinglatticelifecycleMatrixR6rbibutilsRColorBrewerRcppRcppArmadilloRdpackreformulasrlangS7scalesvctrsviridisLitewithr

Causal Inference with BART
Introduction | Confounding | Assumptions for Causal Inference | Checking Positivity | The Estimator: G-Computation | Conditional, Sample, and Population Averages | The Outcome Model | Potential Outcomes | Computation and Scale of the Estimate | The Same Answer Through marginaleffects | Using Bayesian Causal Forests | Conditional Effects | A Second Example: A Continuous Outcome, and the ATT | Interpreting the Credible Interval | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Checking Convergence and Fit
Introduction | Convergence | Every Statistic in One Call (diagnose()) | Running More Than One Chain (chains) | The Rows of the Table | The Exception for eta | Looking at the Chains (as_draws()) | Diagnosing the Quantity Being Reported | Diagnosing Anything Else (summarise_draws()) | Remedies for Poor Mixing | A Worked Example: More Draws, Same Model | Fit | Reading the Prior Back (prior_summary()) | Before the Data: The Prior Predictive (prior_only) | Posterior Predictive Checks (pp_check()) | Checks Worth Reaching For | Calibration | Residuals | The Bayesian R-Squared (r2()) | A Checklist | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Effects, Curves, and Interactions
Introduction | Predictions, Comparisons, and Slopes | Average Effects (avg_comparisons()) | The Splitting Prior and a Contrast (sparsity) | Choosing the Step (variables) | Effects for Subgroups (by) | The Shape of a Relationship (partial_dependence()) | Values of the Second Predictor | The Same Curve Through marginaleffects | Slopes and the Predictor Transform (avg_slopes()) | Descriptions of the Fitted Model | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Frequently Asked Questions
What is BART? | How/When should I use BART? | How can a machine learning method be Bayesian? | How can a Bayesian method be machine learning? | How can BART be used for inference? | How do I get estimates out of the model? | What if I have missing data? | Can I supply my own likelihood? | Why is my model slow, and what should I change first? | What if I'm a frequentist? | Is BART good? | How can BART be used for causal inference? | What are Bayesian Causal Forests? | How do I get a treatment effect? | What papers should I read to better understand BART? | What does the name "bartisan" mean? | How does bartisan differ from other BART implementations in R? | What model family should I use? | How should I select the values of the hyperparameters? | How should I choose how many chains and burn-in and posterior draws? | References

Last update: 2026-10-28
Started: 2026-10-28

Generalized BART with bartisan
Introduction | The Model | A Sum of Trees | The Generalization | The Prior | Soft Rules (gate) | The Predictor Transform (x_transform) | Sparsity (sparsity) | The Sampler | Bayesian Backfitting | Moving the Trees | The General Case, and the Laplace Approximation | Data Augmentation (augment) | Nuisance Parameters | The Dirichlet Process Mixture | Practical Matters | Missing Predictor Values | Several Chains (chains) | Choosing the Settings | Speed | Gains From Data Augmentation (augment) | Correctness | Comparison With Other BART Packages | Notes and Limitations | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Getting Started with bartisan
Introduction | Parallelization and Progress Bars | The Data | Fitting the Model | Checking the Model | Convergence | Fit | Variable Importance | Interpreting the Fit | A Table of Average Comparisons | The Shape of a Relationship | The Effect of a Treatment | Predicting New Observations | Comparing Models | Limitations | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Model Comparison
Introduction | Leave-One-Out Cross-Validation (loo()) | Failures of the Approximation | Comparing Two Models (loo_compare()) | Comparing Links (family) | Comparing Against a Bayesian GLM | Tuning | Additional Topics | A Constant Coefficient Against a Varying One (vc()) | The Scale of the Log Density (scale) | Variable Selection | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Response Families in bartisan
Introduction | The Families | Choosing a Family | The Default Family (family Omitted) | Numeric Responses | Per-Forest Predictors and Settings | Positive Continuous Responses | Binary Responses | Counts | Excess Zeros | Overdispersion in the Count Component | Ordered Categories | The Prior on the Cutpoints (cut_alpha) | Empty Categories | A Continuous Outcome as Ordinal | Unordered Categories | Bounded Responses | A Point Mass at Zero and a Continuous Positive Part | Right-Censored Survival Times | Other Links and Custom Likelihoods | References

Last update: 2026-10-28
Started: 2026-10-28

Survival Analysis in bartisan
Introduction | The Survival Families | Fitting a Model | Choosing a Family | The Error Distribution (error_density()) | Predicted and Observed Survival | Leave-One-Out Cross-Validation (loo()) | Interpreting a Fit | The Additive Predictor (type = "link") | Survival Probabilities (type = "survival") | Median Survival Times (type = "response") | Hazards (type = "hazard") | Averages and Contrasts | Survival Curves | Time Ratios and Hazard Ratios | Additional Topics | The Baseline Hazard Grid (num_bins) | Covariate Effects That Change Over Time | Treatment Effects (bcf()) | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Variable Importance
Introduction | Split Counts and Usage Proportions (variable_importance()) | Calibrating With Noise Predictors | Separation With a Stronger Signal | Correlated Predictors | The Limits of a Usage Ranking | The Number of Trees (num_trees) | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Varying Coefficients and Random Intercepts
Introduction | The Model | Declaring a Varying Coefficient (vc()) | Effect Modifiers (modifiers) | Centering the Covariate (center) | A Constant Coefficient (vc(z, ~ 1)) | Reading a Fit | The Coefficients (coef()) | Effects From the Coefficients (estimate_effect()) | Settings That Vary by Forest | Families With Several Additive Predictors | Bayesian Causal Forests (bcf()) | Random Intercepts ((1 | group)) | Further Reading | References

Last update: 2026-10-28
Started: 2026-10-28

Readme and manuals

Help Manual

Help pageTopics
bartisan: Generalized Bayesian Additive Regression Treesbartisan-package
Fit a generalized Bayesian additive regression trees (BART) modelbartisan
Sampler and prior settings for 'bartisan()'bartisan_control
Response families for generalized BARTbartisan-families Beta dpm dpm_aft Gamma_ls gaussian_ls loglogistic_aft lognormal_aft multinomial negbin ordbeta ordinal ph tweedie weibull_aft zi_negbin zi_poisson
Interfaces to other packagesas_draws.bartisan_fit bartisan-interop fitted.bartisan_fit kfold.bartisan_fit log_lik.bartisan_fit loo.bartisan_fit model_performance.bartisan_fit posterior_epred.bartisan_fit posterior_linpred.bartisan_fit posterior_predict.bartisan_fit pp_check.bartisan_fit print.bartisan_prior_summary prior_summary.bartisan_fit r2.bartisan_fit r2_posterior.bartisan_fit residuals.bartisan_fit sigma.bartisan_fit simulate.bartisan_fit waic.bartisan_fit weights.bartisan_fit
Counterfactual estimands with marginaleffectsbartisan-marginaleffects family.bartisan_fit formula.bartisan_fit get_coef.bartisan_fit get_data.bartisan_fit get_group_names.bartisan_fit get_predict.bartisan_fit get_vcov.bartisan_fit model.frame.bartisan_fit nobs.bartisan_fit set_coef.bartisan_fit terms.bartisan_fit
Bayesian causal forestsbcf
Varying coefficientscoef.bartisan_fit
Fit a model to a likelihood written in Rcustom_family
Check whether a fit converged and mixeddiagnose diagnose.bartisan_effect diagnose.bartisan_fit diagnose.default
Error distribution of a Dirichlet process mixture fiterror_density plot.bartisan_error_density
Causal effects from a fitted modelestimate_effect plot.bartisan_effect print.bartisan_effect
Partial dependence on one or two predictorspartial_dependence plot.bartisan_fit plot.bartisan_partial print.bartisan_partial
Predictions from a generalized BART modelpredict.bartisan_fit
Summarize a generalized BART modelprint.bartisan_fit print.summary.bartisan_fit summary.bartisan_fit
Methods for Bayesian causal forest fitsplot.bcf_fit print.bcf_fit
Group intercepts from a random-effect termranef.bartisan_fit
Right heart catheterization in critically ill patientsrhc
How often each predictor is usedplot.bartisan_importance variable_importance
Give a predictor a varying coefficientvc