# \donttest{
n <- 200
p <- 10
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
Z <- rbinom(n, 1, 0.5)
Y <- 2 * Z * (X[, 1] > 0) + X[, 2] + rnorm(n, 0.1)
# run causal distillation trees without stability diagnostics
out <- causalDT(X, Y, Z, B_stability = 0)
# run stability diagnostics
stability_out <- evaluate_subgroup_stability(
estimator = student_rpart,
fit = out$student_fit$fit,
X = X[-out$holdout_idxs, , drop = FALSE],
y = out$student_fit$predictions
)
# }
Run the code above in your browser using DataLab