Learn R Programming

StratifiedMedicine (version 0.1.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, byTrt = TRUE, 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

byTrt

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

min.node.pct

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

family

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

...

Any additional parameters, not currently passed through.

Value

Trained random forest (ranger) model(s).

  • mods - trained model(s)

  • A - treatment variable (training set)

  • X - covariate space (training set)

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)
summary( predict(mod1, newdata=data.frame(A,X) ) ) # oob predictions for training
summary( predict(mod1, newdata=data.frame(X) ) ) # new-predictions, no oob here

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab