hete_x: X-Learner Meta-Estimator

Description Usage Arguments Value References Examples

View source: R/hete_x.R

Description

X-Learner Meta-Estimator

Usage

1
2
3
4
5
6
7
8
9
hete_x(x, ...)

## Default S3 method:
hete_x(x, y, tmt, est, tmt_est = est, ctl_est = est,
  te_tmt_est = est, te_ctl_est = est, ...)

## S3 method for class 'formula'
hete_x(x, data, est, tmt_est = est, ctl_est = est,
  te_tmt_est = est, te_ctl_est = est, ...)

Arguments

x

a data.frame or matrix with predictor variables measured prior to treatment or unaffected by treatment. Alternatively, this can be a model formula: outcome ~ x1 + x2 | treatment

...

ignored.

y

a vector of outcomes.

tmt

a vector indicating which units received treatment.

est, tmt_est, ctl_est, te_tmt_est, te_ctl_est

an estimator to use for modeling the treatment effect. This must be a function which takes two arguments, x and y and returns an object which has an implementation of predict. The predict implementation must return a single vector with the estimated outcome or probability of success in the case of binary outcomes. By default the same estimator, est is used for all four models in the meta-estimator. You may optionally select a different estimator for one or more of these models. tmt_est and ctl_est are used to estimate the response in the treatment and control groups respectively. te_tmt_est and te_ctl_est are used to estimate the treatment effect in the treatment and control groups.

data

a data.frame containing the variables specified in x when using a formula to specify the model.

Value

A hete_x object.

References

K<c3><bc>nzel, S., Sekhon, J., Bickel, P., & Yu, B. (2017). Meta-learners for Estimating Heterogeneous Treatment Effects using Machine Learning. arXiv preprint arXiv:1706.03461.

Examples

 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_x(voted ~ . | treatment, data = df, est = random_forest)
p <- predict(m, df)

uc <- uplift(df$voted, df$treatment, p)
plot(uc)


## End(Not run)

wlattner/hete documentation built on May 4, 2019, 12:57 a.m.