Learn R Programming

StratifiedMedicine (version 0.2.3)

ple_ranger: Patient-level Estimates: Ranger

Description

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

Usage

ple_ranger(Y, A, X, Xtest, family = "gaussian", byTrt = ifelse(family
  == "survival", FALSE, TRUE), min.node.pct = 0.1, ...)

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

family

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

byTrt

If TRUE, fit treatment-specific ranger models. If FALSE, fit a single ranger model with covariate space (X, A, X*A). For "gaussian" or "binomial", default is TRUE. For "survival", default is FALSE.

min.node.pct

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

...

Any additional parameters, not currently passed through.

Value

Trained random forest (ranger) model(s).

  • mod - trained model(s)

  • pred.fun - Prediction function for trained model(s)

References

Wright, M. N. & Ziegler, A. (2017). ranger: A fast implementation of random forests for high dimensional data in C++ and R. J Stat Softw 77:1-17. https://doi.org/10.18637/jss.v077.i01.

See Also

PRISM, ranger

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_ranger(Y, A, X, Xtest=X)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab