Description Usage Arguments Value Examples
Plot estimated CATEs versus a covariate
1 | plot_predictions_vs_covariate(dat, res, covariate, level = NULL)
|
dat |
The original training data |
res |
The output from |
covariate |
The covariate to plot on the horizontal axis |
level |
The desired confidence level. If |
A ggplot2 plot object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## 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)
dat <- dplyr::bind_cols(as.data.frame(X), results)
dat$a <- sample(letters[1:3], size = n, replace = T)
plot_predictions_vs_covariate(dat, 'V1', level = 0.9)
plot_predictions_vs_covariate(dat, 'a', level = 0.9)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.