Learn R Programming

plotBart (version 0.1.7)

plot_moderator_c_loess: LOESS plot of a continuous moderating variable

Description

Plot the LOESS prediction of ICATEs by a continuous covariate. This is an alternative to partial dependency plots to assess treatment effect heterogeneity by a continuous covariate. See Carnegie, Dorie and Hill 2019.

Usage

plot_moderator_c_loess(.model, moderator, line_color = "blue")

Arguments

.model

a model produced by `bartCause::bartc()`

moderator

the moderator as a vector

line_color

the color of the loess line

Value

ggplot object

References

Carnegie, N., Dorie, V., & Hill, J. L. (2019). Examining treatment effect heterogeneity using BART. Observational Studies, 5(2), 52-70.

Examples

Run this code
# NOT RUN {
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_c_loess(model_results, lalonde$age)
# }

Run the code above in your browser using DataLab