R: Estimate average treatment effects using a causal forest

average_treatment_effect {grf} | R Documentation

## Estimate average treatment effects using a causal forest

### Description

Gets estimates of one of the following.

- The (conditional) average treatment effect (target.sample = all): sum_i = 1^n E[Y(1) - Y(0) | X = Xi] / n

- The (conditional) average treatment effect on the treated (target.sample = treated): sum_Wi = 1 E[Y(1) - Y(0) | X = Xi] / |i : Wi = 1|

- The (conditional) average treatment effect on the controls (target.sample = control): sum_Wi = 0 E[Y(1) - Y(0) | X = Xi] / |i : Wi = 0|

- The overlap-weighted (conditional) average treatment effect sum_i = 1^n e(Xi) (1 - e(Xi)) E[Y(1) - Y(0) | X = Xi] / sum_i = 1^n e(Xi) (1 - e(Xi)), where e(x) = P[Wi = 1 | Xi = x].

This last estimand is recommended by Li, Morgan, and Zaslavsky (JASA, 2017) in case of poor overlap (i.e., when the propensities e(x) may be very close to 0 or 1), as it doesn't involve dividing by estimated propensities.

### Usage

    average_treatment_effect(forest, target.sample = c("all", "treated",
      "control", "overlap"), method = c("AIPW", "TMLE"), subset = NULL)

### Arguments

`forest` | The trained forest.
`target.sample` | Which sample to aggregate treatment effects over.
`method` | Method used for doubly robust inference. Can be either augmented inverse-propensity weighting (AIPW), or targeted maximum likelihood estimation (TMLE).
`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.

### Details

If clusters are specified, then each unit gets equal weight by default. For example, if there are 10 clusters with 1 unit each and per-cluster ATE = 1, and there are 10 clusters with 19 units each and per-cluster ATE = 0, then the overall ATE is 0.05 (additional sample.weights allow for custom weighting). If equalize.cluster.weights = TRUE each cluster gets equal weight and the overall ATE is 0.5.

### Value

An estimate of the average treatment effect, along with standard error.

### Examples

    ## Not run:
    # Train a causal forest.
    n <- 50
    p <- 10
    X <- matrix(rnorm(n * p), n, p)
    W <- rbinom(n, 1, 0.5)
    Y <- pmax(X[, 1], 0) * W + X[, 2] + pmin(X[, 3], 0) + rnorm(n)
    c.forest <- causal_forest(X, Y, W)

    # Predict using the forest.
    X.test <- matrix(0, 101, p)
    X.test[, 1] <- seq(-2, 2, length.out = 101)
    c.pred <- predict(c.forest, X.test)
    # Estimate the conditional average treatment effect on the full sample (CATE).
    average_treatment_effect(c.forest, target.sample = "all")

    # Estimate the conditional average treatment effect on the treated sample (CATT).
    # We don't expect much difference between the CATE and the CATT in this example,
    # since treatment assignment was randomized.
    average_treatment_effect(c.forest, target.sample = "treated")

    # Estimate the conditional average treatment effect on samples with positive X[,1].
    average_treatment_effect(c.forest, target.sample = "all", X[, 1] > 0)

    ## End(Not run)

[Package grf version 1.0.0 Index]