Description Usage Arguments Value Examples
A helper for the new_PlUpliftEval function that validates the treatment, outcome, prediction, p, and n_bins arguments.
1 | plUpliftEval(treatment, outcome, prediction, p = "infer", n_bins = 20)
|
treatment |
numeric vector of treatment identifiers |
outcome |
numeric vector of outcomes |
prediction |
numeric vector of uplift predictions |
p |
optional "infer", numeric, numeric vector representing treatment propensities |
n_bins |
integer number of bins on x-axis; default 20 |
a list representing a pylift uplift eval object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | set.seed(0)
rl <- function(x){
round(1/(1+exp(-x)))
}
n <- 2000; p <- 3
beta <- -0.5
X <- matrix(rnorm(n*p), n, p)
W <- rbinom(n, 1, 0.5)
Y <- rl(pmax(beta+X[,1], 0) * W + X[,2])
p1 <- 1/(1+exp(-(beta+X[,1])))
plUpliftEval(W, Y, p1)
library(grf)
set.seed(123)
rl <- function(x){
round(1/(1+exp(-x)))
}
n <- 2000; p <- 10
X <- matrix(rnorm(n*p), n, p)
W <- rbinom(n, 1, 0.2)
Y <- rl(rl(X[,1]) * W - rl(X[,3]) * W + rnorm(n))
tau.forest <- causal_forest(X, Y, W)
tau.hat <- predict(tau.forest, X)
plue <- plUpliftEval(W, Y, tau.hat$predictions)
plue
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.