Learn R Programming

StratifiedMedicine (version 0.1.3)

predict.ple_ranger: Predict Patient-level Estimates: Ranger

Description

Get estimates of (E(Y|X,A=1), E(Y|X,A=0), E(Y|X,A=1)-E(Y|X,A=0)) using trained random forest (ranger) model(s).

Usage

# S3 method for ple_ranger
predict(object, newdata = NULL, oob = FALSE, ...)

Arguments

object

Trained random forest (ranger) model(s).

newdata

Data-set to make predictions at (Default=NULL, predictions correspond to training data).

oob

Use out-of-bag predictions (default=TRUE). Only applicable for training data (newdata=NULL).

...

Any additional parameters, not currently passed through.

Value

Data-frame with predictions of (E(Y|X,A=1), E(Y|X,A=0), E(Y|X,A=1)-E(Y|X,A=0)) or survival probabilities and difference in restricted mean survival time (RMST), (S(T|X,A=1), S(T|X,A=0), RMST(A=1,X)-RMST(A=0,X) )

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


# Default (treatment-specific ranger models) #
mod1 = ple_ranger(Y, A, X, Xtest=X)
summary( predict(mod1 ) ) # oob predictions for training
summary( predict(mod1, newdata=X ) ) # new-predictions, no oob here
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab