Uses the causal forest algorithm (grf R package) to obtain patient-level estimates, E(Y|A=1), E(Y|A=0), and E(Y|A=1)-E(Y|A=0). Usable for continuous or binary outcomes.
ple_causal_forest(Y, A, X, Xtest, tune = FALSE, num.trees = 500,
family = "gaussian", mod.A = "mean", ...)
The outcome variable. Must be numeric or survival (ex; Surv(time,cens) )
Treatment variable. (a=1,...A)
Covariate space.
Test set
If TRUE, use grf automatic hyper-parameter tuning. If FALSE (default), no tuning.
Number of trees (default=500)
Outcome type ("gaussian", "binomial"), default is "gaussian"
Model for estimating P(A|X). Default is "mean" calculates the sample mean. If mod.A="RF", estimate P(A|X) using regression_forest (applicable for non-RCTs).
Any additional parameters, not currently passed through.
Trained causal_forest and regression_forest models.
mod - trained model(s)
pred.fun - Prediction function for trained model(s)
Athey S, Tibshirani J, Wagner S. Generalized Random Forests. https://arxiv.org/abs/1610.01271