Learn R Programming

plotBart

plotBart is a diagnostic and plotting package for bartCause and thinkCausal.

library(plotBart)
data(lalonde)
confounders <- c('age', 'educ', 'black', 'hisp', 'married', 'nodegr')

# fit BART model
model_results <- bartCause::bartc(
  response = lalonde[['re78']],
  treatment = lalonde[['treat']],
  confounders = as.matrix(lalonde[, confounders]),
  estimand = 'ate',
  commonSup.rule = 'none',
  verbose = FALSE,
  keepTrees = TRUE
)

# plot common support
plot_common_support(.model = model_results)
# plot CATE and manipulate ggplot object
plot_CATE(
  .model = model_results, 
  type = 'density', 
  ci_80 = TRUE, 
  ci_95 = TRUE,
  .mean = TRUE
) + 
  labs(subtitle = 'My comments on the results') +
  theme_classic()

Installation

plotBart is currently in development and is available to test by installing via:

# install.packages("remotes")
remotes::install_github('priism-center/plotBart@*release')

Copy Link

Version

Install

install.packages('plotBart')

Monthly Downloads

199

Version

0.1.7

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Joseph Marlo

Last Published

May 27th, 2022

Functions in plotBart (0.1.7)

plot_trace

Trace plot the estimands of a `bartCause::bartc()` model
plot_overlap_vars

Plot the overlap of variables
plot_overlap_pScores

Plot the overlap via propensity score method
plot_PATE

Plot histogram or density of Population Average Treatment Effect
plot_moderator_search

Plot a single regression tree of covariates on ICATEs
plot_moderator_d_linerange

Plot the posterior interval of the Conditional Average Treatment Effect grouped by a discrete variable
plot_waterfall

Plot a waterfall of the ICATEs
plot_SATE

Plot histogram or density of Sample Average Treatment Effects
plot_moderator_c_pd

Partial dependency plot of a continuous moderating variable
plot_common_support

Plot common support based on the standard deviation rule, chi squared rule, or both
plot_moderator_c_loess

LOESS plot of a continuous moderating variable
plot_balance

Plot the balance
plot_moderator_d_density

Plot the Conditional Average Treatment Effect conditional on a discrete moderator
plot_ICATE

Plot Individual Conditional Average Treatment effects
lalonde

Lalonde dataset
plot_CATE

Plot the histogram or density of the Conditional Average Treatment Effect