Learn R Programming

grf (version 1.2.0)

best_linear_projection: Estimate the best linear projection of a conditional average treatment effect using a causal forest.

Description

Let tau(Xi) = E[Y(1) - Y(0) | X = Xi] be the CATE, and Ai be a vector of user-provided covariates. This function provides a (doubly robust) fit to the linear model

Usage

best_linear_projection(
  forest,
  A = NULL,
  subset = NULL,
  debiasing.weights = NULL,
  num.trees.for.variance = 500
)

Arguments

forest

The trained forest.

A

The covariates we want to project the CATE onto.

subset

Specifies subset of the training examples over which we estimate the ATE. WARNING: For valid statistical performance, the subset should be defined only using features Xi, not using the treatment Wi or the outcome Yi.

debiasing.weights

A vector of length n (or the subset length) of debiasing weights. If NULL (default) and the treatment is binary, then inverse-propensity weighting is used, otherwise, if the treatment is continuous, these are estimated by a variance forest.

num.trees.for.variance

Number of trees used to estimate Var[Wi | Xi = x]. Default is 500. (only applies with continuous treatment and debiasing.weights = NULL)

Value

An estimate of the best linear projection, along with coefficient standard errors.

Details

tau(Xi) ~ beta_0 + Ai * beta

Procedurally, we do so by regressing doubly robust scores derived from the causal forest against the Ai. Note the covariates Ai may consist of a subset of the Xi, or they may be distinct The case of the null model tau(Xi) ~ beta_0 is equivalent to fitting an average treatment effect via AIPW.

In the event the treatment is continuous the inverse-propensity weight component of the double robust scores are replaced with a component based on a forest based estimate of Var[Wi | Xi = x]. These weights can also be passed manually by specifying debiasing.weights.

References

Chernozhukov, Victor, and Vira Semenova. "Simultaneous inference for Best Linear Predictor of the Conditional Average Treatment Effect and other structural functions." arXiv preprint arXiv:1702.06240 (2017).

Examples

Run this code
# NOT RUN {
n <- 800
p <- 5
X <- matrix(rnorm(n * p), n, p)
W <- rbinom(n, 1, 0.25 + 0.5 * (X[, 1] > 0))
Y <- pmax(X[, 1], 0) * W + X[, 2] + pmin(X[, 3], 0) + rnorm(n)
forest <- causal_forest(X, Y, W)
best_linear_projection(forest, X[,1:2])
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab