Computes a matrix of double robust scores \(\Gamma_{ia} = \mu_a(x) + \frac{1}{e_a(x)} (Y_i - \mu_a(x)) 1(A_i=a)\)

# S3 method for causal_forest
double_robust_scores(object, ...)

# S3 method for causal_survival_forest
double_robust_scores(object, ...)

# S3 method for instrumental_forest
double_robust_scores(object, compliance.score = NULL, ...)

# S3 method for multi_arm_causal_forest
double_robust_scores(object, outcome = 1, ...)

double_robust_scores(object, ...)

Arguments

object

An appropriate causal forest type object

...

Additional arguments

compliance.score

An estimate of the causal effect of Z on W. i.e., Delta(X) = E(W | X, Z = 1) - E(W | X, Z = 0), for each sample i = 1, ..., n. If NULL (default) then this is estimated with a causal forest.

outcome

Only used with multi arm causal forets. In the event the forest is trained with multiple outcomes Y, a column number/name specifying the outcome of interest. Default is 1.

Value

A matrix of scores for each treatment

Details

This is the matrix used for CAIPWL (Cross-fitted Augmented Inverse Propensity Weighted Learning)

Methods (by class)

  • double_robust_scores(causal_forest): Scores \((\Gamma_0, \Gamma_1)\)

  • double_robust_scores(causal_survival_forest): Scores \((\Gamma_0, \Gamma_1)\)

  • double_robust_scores(instrumental_forest): Scores \((-\Gamma, \Gamma)\)

  • double_robust_scores(multi_arm_causal_forest): Matrix \(\Gamma\) of scores for each treatment \(a\)

Note

For instrumental_forest this method returns \((-\Gamma_i, \Gamma_i)\) where \(\Gamma_i\) is the double robust estimator of the treatment effect as in eqn. (44) in Athey and Wager (2021).

References

Athey, Susan, and Stefan Wager. "Policy Learning With Observational Data." Econometrica 89.1 (2021): 133-161.

Examples

# \donttest{ # Compute double robust scores for a multi-arm causal forest n <- 500 p <- 10 X <- matrix(rnorm(n * p), n, p) W <- as.factor(sample(c("A", "B", "C"), n, replace = TRUE)) Y <- X[, 1] + X[, 2] * (W == "B") + X[, 3] * (W == "C") + runif(n) forest <- grf::multi_arm_causal_forest(X, Y, W) scores <- double_robust_scores(forest) head(scores)
#> A B C #> [1,] -0.7501825 1.9719786 -0.1351580 #> [2,] 0.7770389 0.1808205 1.4388129 #> [3,] 0.5474922 -0.7772314 -0.3222134 #> [4,] 1.7367082 0.8403631 0.5922094 #> [5,] 2.2195307 1.1593310 2.0424350 #> [6,] 0.1397635 2.1782259 -0.4953584
# Compute double robust scores for a causal forest n <- 500 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 <- grf::causal_forest(X, Y, W) scores <- double_robust_scores(c.forest) # }