Skip to contents

A quantile contrast is a mean contrast of an indicator, so the honest forest runs on 1{Y <= q_tau}. A negative CDF contrast means treatment pushes mass above the threshold, so shift_effect is its negation. Mirrors morie.fn.qbcfgr.

Usage

morie_quantile_causal_forest(
  y,
  d,
  x,
  quantile = 0.5,
  n_trees = 200L,
  min_leaf = 15L,
  seed = 0L
)

Arguments

y

Outcome.

d

Binary 0/1 treatment.

x

Covariates.

quantile

Quantile level in (0, 1).

n_trees, min_leaf, seed

Forest hyperparameters.

Value

List with cdf_effect, shift_effect, threshold, quantile, ate_cdf, n, forest.

References

Athey S, Tibshirani J, Wager S (2019). Generalized random forests. The Annals of Statistics 47(2), 1148-1178.

Examples

set.seed(4)
n <- 120
X <- matrix(rnorm(n * 2), n, 2)
d <- rbinom(n, 1, 0.5)
y <- 1 + X[, 1] + d * 0.8 + rnorm(n, 0, 0.3)
r <- morie_quantile_causal_forest(y, d, X, quantile = 0.5, n_trees = 20L)
str(r, max.level = 1)
#> List of 7
#>  $ cdf_effect  : num [1:120] -0.227 -0.227 -0.227 -0.227 -0.227 ...
#>  $ shift_effect: num [1:120] 0.227 0.227 0.227 0.227 0.227 ...
#>  $ threshold   : num 1.37
#>  $ quantile    : num 0.5
#>  $ ate_cdf     : num -0.227
#>  $ n           : int 120
#>  $ forest      :List of 2