| hte_plot | R Documentation |
Produces plot to illustrate sub-group Heterogeneous Treatment Effects (HTE)
of estimated CATEs from metalearner_ensemble and
metalearner_neural, as well as PATT-C from pattc_ensemble
and pattc_neural.
hte_plot(
x,
...,
boot = TRUE,
n_boot = 1000,
cut_points = NULL,
custom_labels = NULL,
zero_int = TRUE,
selected_vars = NULL
)
x |
estimated model from |
... |
Additional arguments |
boot |
logical for using bootstraps to estimate confidence intervals. |
n_boot |
number of bootstrap iterations. Only used with boot = TRUE. |
cut_points |
numeric vector for cut-off points to generate subgroups from covariates. If left blank a vector generated from median values will be used. |
custom_labels |
character vector for the names of subgroups. |
zero_int |
logical for vertical line at 0 x intercept. |
selected_vars |
vector for names of covariates to use for subgroups. |
ggplot object illustrating subgroup HTE and 95% confidence
intervals.
# load dataset
set.seed(123456)
xlearner_nn <- metalearner_neural(cov.formula = support_war ~ age +
income + employed + job_loss,
data = exp_data,
treat.var = "strong_leader",
meta.learner.type = "X.Learner",
stepmax = 2e+9,
nfolds = 5,
algorithm = "rprop+",
hidden.layer = c(3),
linear.output = FALSE,
binary.preds = FALSE)
hte_plot(xlearner_nn)
hte_plot(xlearner_nn,
selected_vars = c("age", "income"),
cut_points = c(33, 3),
custom_labels = c("Age <= 33", "Age > 33", "Income <= 3", "Income > 3"),
n_boot = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.