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).
# S3 method for ple_ranger
predict(object, newdata = NULL, oob = TRUE, ...)
Trained random forest (ranger) model(s).
Data-set to make predictions at (Default=NULL, predictions correspond to training data).
Use out-of-bag predictions (default=TRUE). Only applicable for training data (newdata=NULL).
Any additional parameters, not currently passed through.
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) )
# 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