Skip to contents

An honest causal forest whose split criterion carries GRF's imbalance penalty: \(\Delta - \gamma(1/n_L + 1/n_R)\).

Usage

morie_egregious_loss_forest(
  y,
  D,
  X,
  n_trees = 200L,
  min_leaf = 10L,
  max_depth = 6L,
  imbalance_penalty = 100,
  subsample = 0.5,
  seed = 0L
)

Arguments

y

outcome.

D

0/1 treatment.

X

covariates.

n_trees, min_leaf, max_depth, subsample

forest controls.

imbalance_penalty

gamma above.

seed

integer seed.

Value

list with cate (out-of-bag), ate, se, ci, leaf_sizes, n_leaves.

Details

The unregularized heterogeneity criterion is maximised, other things equal, by carving off the smallest admissible leaf – the extreme tau it reports is mostly estimation noise, and the noise is what earns the split. The penalty is large exactly when one child is tiny, so leaf losses come out balanced rather than concentrated.

Gamma carries the units of the criterion itself, \(n(\Delta\tau)^2\), so it is NOT scale-free: a value that regularizes one problem is a no-op on another with larger effects or more data. Sweep it and watch the leaf count.

References

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

Examples

if (requireNamespace("ranger", quietly = TRUE)) {
  set.seed(1)
  X <- matrix(rnorm(1200), ncol = 4)
  D <- rbinom(300, 1, 0.5)
  y <- X[, 2] + ifelse(X[, 1] > 0, 2, -2) * D + rnorm(300, 0, 0.5)
  r <- morie_egregious_loss_forest(y, D, X, n_trees = 40)
  round(mean(r$cate[X[, 1] > 0], na.rm = TRUE), 2)
}
#> [1] 0.97