Skip to contents

Refits an honest forest on each of B bootstrap resamples and takes percentile intervals across replicates. Intervals from a single forest's tree spread understate the uncertainty because the trees share the training data. Mirrors morie.fn.crfboot.

Usage

morie_causal_forest_bootstrap(
  y,
  d,
  x,
  B = 40L,
  n_trees = 60L,
  min_leaf = 10L,
  seed = 0L,
  alpha = 0.05
)

Arguments

y, d, x

As in morie_causal_forest().

B

Bootstrap replicates.

n_trees, min_leaf, seed

Per-forest hyperparameters.

alpha

Two-sided interval level.

Value

List with cate, ci_low, ci_high, se, ate, ate_ci, B, n.

References

Wager S, Athey S (2018). Estimation and inference of heterogeneous treatment effects using random forests. JASA 113(523), 1228-1242.

Examples

set.seed(2)
n <- 100
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_causal_forest_bootstrap(y, d, X, B = 8L, n_trees = 15L)
str(r, max.level = 1)
#> List of 8
#>  $ cate   : num [1:100] 0.781 0.781 0.781 0.781 0.781 ...
#>  $ ci_low : num [1:100] 0.25 0.25 0.25 0.25 0.25 ...
#>  $ ci_high: num [1:100] 1.1 1.1 1.1 1.1 1.1 ...
#>  $ se     : num [1:100] 0.338 0.338 0.338 0.338 0.338 ...
#>  $ ate    : num 0.781
#>  $ ate_ci : num [1:2] 0.25 1.1
#>  $ B      : int 8
#>  $ n      : int 100