Learn R Programming

Bayesian Causal Forests

Welcome to the bcf site! This page provides hands-on examples of how to conduct Bayesian causal forest (BCF) analyses. You can find methodological details on the underlying modeling approach in the original BCF paper: Hahn, Murray, and Carvalho 2020.

Why BCF?

BCF is a cutting-edge model for causal inference that builds on Bayesian Additive Regression Trees (BART, Chipman, George, and McCulloch 2010). BART and BCF both combine Bayesian regularization with regression trees to provide a highly flexible response surface that, thanks to regularization from prior distributions, does not overfit to the training data. BCF extends BART's flexibility by specifying different models for relationships between (1) covariates and the outcome and (2) covariates and the treatment effect, and regularizing the treatment effect directly.

BCF performs remarkably well in simulation and has led the pack at recent rigorous causal inference competitions, such as those held at the Atlantic Causal Inference Conference (see, for example, Dorie et al. 2019).

Getting Started

If you are just getting started with bcf, we recommend beginning with the tutorial vignettes.

Installation

This package requires compilation, so make sure you have Rtools properly installed if you are on Windows -- see this site for details.

Install the latest release from CRAN:

install.packages("bcf")

Install the latest development version from GitHub:

if (!require("devtools")) {
  install.packages("devtools")
}
devtools::install_github("jaredsmurray/bcf")

Copy Link

Version

Install

install.packages('bcf')

Monthly Downloads

383

Version

2.0.2

License

GPL-3

Maintainer

Jared Murray

Last Published

February 27th, 2024

Functions in bcf (2.0.2)

summary.bcf

Takes a fitted bcf object produced by bcf() and produces summary stats and MCMC diagnostics. This function is built using the coda package and meant to mimic output from rstan::print.stanfit(). It includes, for key parameters, posterior summary stats, effective sample sizes, and Gelman and Rubin's convergence diagnostics. By default, those parameters are: sigma (the error standard deviation when the weights are all equal), tau_bar (the estimated sample average treatment effect), mu_bar (the average outcome under control/z=0 across all observations in the sample), and yhat_bat (the average outcome under the realized treatment assignment across all observations in the sample).
predict.bcf

Takes a fitted bcf object produced by bcf() along with serialized tree samples and produces predictions for a new set of covariate values
bcf

Fit Bayesian Causal Forests