ple_causal_forest: Patient-level Estimates: Causal Forest

Description Usage Arguments Value References Examples

View source: R/ple_causal_forest.R

Description

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.

Usage

1
2
ple_causal_forest(Y, A, X, Xtest, tune = FALSE, num.trees = 500,
  family = "gaussian", mod.A = "mean", ...)

Arguments

Y

The outcome variable. Must be numeric or survival (ex; Surv(time,cens) )

A

Treatment variable. (a=1,...A)

X

Covariate space.

Xtest

Test set

tune

If TRUE, use grf automatic hyper-parameter tuning. If FALSE (default), no tuning.

num.trees

Number of trees (default=500)

family

Outcome type ("gaussian", "binomial"), default is "gaussian"

mod.A

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.

Value

Trained causal_forest and regression_forest models.

References

Athey S, Tibshirani J, Wagner S. Generalized Random Forests. https://arxiv.org/abs/1610.01271

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(StratifiedMedicine)

## Continuous ##
dat_ctns = generate_subgrp_data(family="gaussian")
Y = dat_ctns$Y
X = dat_ctns$X
A = dat_ctns$A


require(grf)
mod1 = ple_causal_forest(Y, A, X, Xtest=X)
summary(mod1$mu_train)

StratifiedMedicine documentation built on March 1, 2020, 9:07 a.m.