plot_moderator_d_density {plotBart} | R Documentation |
Plot the Conditional Average Treatment Effect conditional on a discrete moderator
Description
Plot the Conditional Average Treatment Effect split by a discrete moderating variable. This plot will provide a visual test of moderation by discrete variables.
Usage
plot_moderator_d_density(
.model,
moderator,
.alpha = 0.7,
facet = FALSE,
.ncol = 1
)
Arguments
.model |
a model produced by 'bartCause::bartc()' |
moderator |
the moderator as a vector |
.alpha |
transparency value [0, 1] |
facet |
TRUE/FALSE. Create panel plots of each moderator level? |
.ncol |
number of columns to use when faceting |
Value
ggplot object
Author(s)
George Perrett
Examples
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'
)
plot_moderator_d_density(model_results, lalonde$educ)
[Package plotBart version 0.1.7 Index]