\(\mu_a = m(x) + (1-e_a(x))\tau_a(x)\)

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

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

# S3 method for instrumental_forest
conditional_means(object, ...)

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

conditional_means(object, ...)

Arguments

object

An appropriate causal forest type object

...

Additional arguments

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 estimated mean rewards

Methods (by class)

  • conditional_means(causal_forest): Mean rewards \(\mu\) for control/treated

  • conditional_means(causal_survival_forest): Mean rewards \(\mu\) for control/treated

  • conditional_means(instrumental_forest): Mean rewards \(\mu\) for control/treated

  • conditional_means(multi_arm_causal_forest): Mean rewards \(\mu\) for each treatment \(a\)

Examples

# \donttest{ # Compute conditional means 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) mu.hats <- conditional_means(forest) head(mu.hats)
#> A B C #> [1,] -0.7427991 -1.4902451 -1.0782366 #> [2,] 0.6192057 1.3040476 0.3668783 #> [3,] -1.4264362 -1.0146372 -0.7595196 #> [4,] 0.4765792 0.7675958 -0.3966188 #> [5,] 1.3470327 0.5297886 0.5861858 #> [6,] 1.7781017 1.8904472 1.4167694
# Compute conditional means 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) mu.hats <- conditional_means(c.forest) # }