Use grf_cate() and grf_crr() to fit
treatment-effect models with the grf package. Pass your
data directly, with optional nuisance estimates. Both functions return
an hte3_model with predict() and
summary() methods.
Choose the target
- Use
grf_cate()when the target is a conditional mean difference. - Use
grf_crr()when the target is a conditional risk ratio and the outcome is non-negative.
Choose a CATE method
grf_cate() supports
method = c("dr", "r", "ep").
-
method = "r"trainsgrf::causal_forest(). -
method = "dr"uses the DR-learner with GRF nuisance and base learners. -
method = "ep"uses the EP-learner with GRF nuisance and base learners.
Within the EP family, ep_targeting_style = "dr" selects
EP-DR and ep_targeting_style = "r" selects EP-R. If you
pass ep_targeting_style = c("dr", "r"), cross-validation
can compare both EP variants.
If you omit both method and cross_validate,
grf_cate() compares the default EP-R candidate and the GRF
causal forest.
grf_crr()
grf_crr() supports
method = c("ep", "ipw", "t"). If you omit
method, the wrapper fits one EP model.
Supply nuisance estimates
The GRF wrappers accept direct nuisance estimates:
-
mu.hat: ann x 2matrix ordered as(control, treatment) -
pi.hat: a length-nvector forP(A = treatment_level | X) -
m.hat: an optional length-nvector estimatingE[Y | X]
If m.hat is omitted and both mu.hat and
pi.hat are supplied, hte3 computes
m.hat internally.
Tuning and cross-validation
Use these arguments to control the fit:
-
cross_fitandfoldsfor nuisance estimation -
cross_validateandcv_controlfor outer learner selection -
ep_targeting_styleandep_r_targeting_basisfor the EP variants -
treatment_levelandcontrol_levelwhen treatment labels are not the default1and0 -
grf_paramsfor GRF hyperparameters such asnum.treesormin.node.size -
tunefor the amount of GRF tuning:"light","none", or"all"
In the GRF learners, tune = "light" tunes
sample.fraction, mtry, and
min.node.size with a modest search budget.
tune = "none" disables tuning, and
tune = "all" tunes all parameters supported by GRF.
Supported treatments and outcomes
-
grf_cate()andgrf_crr()currently support binary treatment only. -
grf_crr()requires a non-negative outcome. - For continuous-treatment CATE, use
hte_task()andfit_cate(..., method = "r").
Construct learners directly
Use these helpers to construct GRF learners for a custom
sl3 model library or manual cross-validation:
make_grf_base_learner()make_grf_nuisance_learners()make_grf_cate_learners()make_grf_crr_learners()