Learn R Programming

StratifiedMedicine (version 0.2.3)

ple_rfsrc: Patient-level Estimates: randomForestSRC

Description

Uses treatment-specific (or with explicit X*A interactions) random forest models (randomForestSRC package) to obtain patient-level estimates. Used for continuous, binary, or survival outcomes.

Usage

ple_rfsrc(Y, A, X, Xtest, ntree = 1000, byTrt = TRUE, upweight = 100,
  min.node.pct = 0.1, family = "gaussian", ...)

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

ntree

Number of trees (default=1000)

byTrt

If TRUE, fit treatment-specific rfsrc models. If FALSE, fit a single rfsrc model with covariate space (X, A, X*A).

upweight

Whether to upweight the probability that the treatment variable is included as a splitting variable (through rfsrc's xvar.wt argument). Default=100 (other variables receive weight of 1). Only applicable for single rfsrc model (byTrt=FALSE).

min.node.pct

Minimum sample size in forest nodes (n*min.node.pct)

family

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

...

Any additional parameters, not currently passed through.

Value

Trained random forest (rfsrc) model(s).

  • mod - trained model(s)

  • A - treatment variable (training set)

  • X - covariate space (training set)

References

  • Breiman L. (2001). Random forests, Machine Learning, 45:5-32.

  • Ishwaran H., Kogalur U.B., Blackstone E.H. and Lauer M.S. (2008). Random survival forests, Ann. App. Statist., 2:841-860.

Examples

Run this code
# NOT RUN {
library(StratifiedMedicine)
## Continuous ##
dat_ctns = generate_subgrp_data(family="gaussian")
Y = dat_ctns$Y
X = dat_ctns$X
A = dat_ctns$A

# Counter-factual Random Forest (treatment-specific ranger models) #
mod1 = ple_rfsrc(Y, A, X, Xtest=X)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab