Heterogeneous ATT: DiD taken locally under forest weights
Usage
did_forest(
Y,
D,
X,
event_time,
x_eval = NULL,
n_trees = 200L,
min_leaf = 5L,
alpha = 0.05,
max_depth = 12L,
seed = 0L,
kind = "double-sample",
clusters = NULL
)Arguments
- Y
Balanced n-by-T panel.
- D
0/1 adoption vector.
- X
Covariate matrix.
- event_time
H.- x_eval
Optional points at which to evaluate; default training rows.
- n_trees
Number of trees.
- min_leaf
Minimum leaf size.
- alpha
Honest subsample fraction.
- max_depth
Maximum tree depth.
- seed
Seed for the shared generator.
- kind
Forest subsampling scheme passed to
hntfst.- clusters
Optional cluster IDs.
Examples
# \donttest{
set.seed(4)
n <- 200
X <- matrix(rnorm(n * 2), n, 2)
D <- rbinom(n, 1, 0.5)
Y <- matrix(rnorm(n * 4), n, 4)
Y[, 3:4] <- Y[, 3:4] + D * (1 + X[, 1])
f <- did_forest(Y, D, X, event_time = 3, n_trees = 50L)
names(f)
#> [1] "estimate" "tau" "delta" "att_uniform"
#> [5] "treated_weight" "control_weight" "n" "n_trees"
#> [9] "event_time" "design" "method"
# }
