Description Usage Arguments Value Examples
Single Estimator
1 2 3 4 5 6 7 8 9 10 | hete_single(x, ...)
## Default S3 method:
hete_single(x, y, tmt, est, ...)
## S3 method for class 'formula'
hete_single(x, data, est, ...)
## S3 method for class 'hete_single'
predict(object, newdata, ...)
|
x |
a |
... |
ignored. |
y |
a vector of outcomes. |
tmt |
a vector indicating which units received treatment. |
est |
an estimator to use for modeling the treatment effect. This must
be a function which takes two arguments, |
data |
a |
object |
A |
newdata |
A |
A hete_single
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
library(tidyverse)
data(gotv)
df <- gotv %>%
filter(treatment %in% c("Control", "Neighbors")) %>%
mutate(treatment = ifelse(treatment == "Control", 0, 1))
m <- hete_single(voted ~ . | treatment, data = df, est = random_forest)
p <- predict(m, df)
uc <- uplift(df$voted, df$treatment, p)
plot(uc)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.