View source: R/plot_moderators.R
plot_moderator_c_pd | R Documentation |
Plot a partial dependency plot with a continuous covariate from a 'bartCause' model. Identify treatment effect variation predicted across levels of a continuous variable.
plot_moderator_c_pd(.model, moderator, n_bins = NULL)
.model |
a model produced by 'bartCause::bartc()' |
moderator |
the moderator as a vector |
n_bins |
number of bins to cut the moderator with. Defaults to the lesser of 15 and number of distinct levels of the moderator |
Partial dependency plots are one way to evaluate heterogeneous treatment effects that vary by values of a continuous covariate. For more information on partial dependency plots from BART causal inference models see Green and Kern 2012.
ggplot object
George Perrett, Joseph Marlo
Green, D. P., & Kern, H. L. (2012). Modeling heterogeneous treatment effects in survey experiments with Bayesian additive regression trees. Public opinion quarterly, 76(3), 491-511.
data(lalonde) confounders <- c('age', 'educ', 'black', 'hisp', 'married', 'nodegr') model_results <- bartCause::bartc( response = lalonde[['re78']], treatment = lalonde[['treat']], confounders = as.matrix(lalonde[, confounders]), estimand = 'ate', commonSuprule = 'none', keepTrees = TRUE ) plot_moderator_c_pd(model_results, lalonde$age)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.