plot_moderator_d_linerange {plotBart}R Documentation

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

Description

Plots the range of the Conditional Average Treatment Effect grouped by a discrete variable. This is analogous to plot_moderator_d_density but is preferable for moderators with many categories. Rather than plotting the full density, the posterior range is shown.

Usage

plot_moderator_d_linerange(.model, moderator, .alpha = 0.7, horizontal = FALSE)

Arguments

.model

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

moderator

the moderator as a vector

.alpha

transparency value [0, 1]

horizontal

flip the plot horizontal?

Value

ggplot object

Author(s)

George Perrett, Joseph Marlo

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_linerange(model_results, lalonde$educ)


[Package plotBart version 0.1.7 Index]