Description Usage Arguments Details Value Examples
Visualize the heterogeneity heuristic described in
estimate_subgroup_ate
. If more than one subgroup is given, they
are all displayed in the plot.
1 | plot_subgroup_ates(fit, subgroups, level = 0.9)
|
fit |
A trained causal forest object from
|
subgroups |
A logical vector indicating whether an observation belongs to the subgrouping, or a list/data frame of such vectors. |
level |
The width of the reported confidence intervals |
If subgroups
is a data.frame
, the columns are assumed to be the
subgroups. They should all be logical, otherwise unexpected behavior may
occur.
A ggplot2 plot object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
require(grf)
n <- 2000; p <- 10
X <- matrix(rnorm(n * p), n, p)
W <- rbinom(n, 1, 0.4 + 0.2 * (X[, 1] > 0))
Y <- pmax(X[, 1], 0) * W + X[, 2] + pmin(X[, 3], 0) + rnorm(n)
cf <- causal_forest(X, Y, W)
results <- tidy_cf(cf)
grps <- data.frame(
high_cate = results$cate > median(results$cate),
high_X3 = X[, 3] > median(X[, 3])
)
plot_subgroup_ates(cf, grps)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.