Learn R Programming

DeepLearningCausal (version 0.0.106)

hte_plot: hte_plot

Description

Produces plot to illustrate sub-group Heterogeneous Treatment Effects (HTE) of estimated CATEs from metalearner_ensemble and metalearner_deepneural, as well as PATT-C from pattc_ensemble and pattc_neural.

Usage

hte_plot(
  x,
  ...,
  boot = TRUE,
  n_boot = 1000,
  cut_points = NULL,
  custom_labels = NULL,
  zero_int = TRUE
)

Value

ggplot object illustrating subgroup HTE and 95% confidence intervals.

Arguments

x

estimated model from metalearner_ensemble, metalearner_deepneural, pattc_ensemble, or pattc_neural.

...

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.

Examples

Run this code
# \donttest{
# load dataset
set.seed(123456)
xlearner_nn <- metalearner_deepneural(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.outcome = FALSE)

hte_plot(xlearner_nn)
                                  # }
                    

Run the code above in your browser using DataLab