plot_dependence {StratifiedMedicine} | R Documentation |
Partial dependence plots: Single Variable (marginal effect) or heat map (2 to 3 variables).
Description
Partial dependence plots: Single Variable (marginal effect) or heat map (2 to 3 variables).
Usage
plot_dependence(object, X = NULL, target = NULL, vars, grid.data = NULL, ...)
Arguments
object |
Fitted |
X |
input covariate space. Default=NULL. |
target |
Which patient-level estimate to target for PDP based plots. Default=NULL, which uses the estimated treatment difference. |
vars |
Variables to visualize (ex: c("var1", "var2", "var3)). If no grid.data provided, defaults to using seq(min(var), max(var)) for each continuous variables. For categorical, uses all categories. |
grid.data |
Input grid of values for 2-3 covariates (if 3, last variable cannot be continuous). This is required for type="heatmap". Default=NULL. |
... |
Additional arguments (currently ignored). |
Value
Plot (ggplot2) object
References
Friedman, J. Greedy function approximation: A gradient boosting machine. Annals of statistics (2001): 1189-1232
Zhao, Qingyuan, and Trevor Hastie. Causal interpretations of black-box models. Journal of Business & Economic Statistics, to appear. (2017).
Examples
library(StratifiedMedicine)
## Continuous ##
dat_ctns = generate_subgrp_data(family="gaussian")
Y = dat_ctns$Y
X = dat_ctns$X
A = dat_ctns$A
# Fit through ple_train wrapper #
mod = ple_train(Y=Y, A=A, X=X, Xtest=X, ple="ranger", meta="X-learner")
plot_dependence(mod, X=X, vars="X1")