Learn R Programming

StratifiedMedicine (version 0.1.3)

predict.submod_otr: Predict submod: OTR CTREE

Description

Predict subgroups and obtain subgroup-specific estimates, P(PLE>thres), for a trained ctree OTR model.

Usage

# S3 method for submod_otr
predict(object, newdata = NULL, ...)

Arguments

object

Trained ctree model.

newdata

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

...

Any additional parameters, not currently passed through.

Value

Identified subgroups with subgroup-specific predictions of P(PLE>thres).

  • Subgrps - Identified subgroups

  • pred - Predictions, P(PLE>thres) by identified subgroup.

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

# }
# NOT RUN {
## Estimate PLEs (through Ranger) ##
res.ple = ple_train(Y, A, X, Xtest=X, family="gaussian", ple="ple_ranger")

## Fit OTR Subgroup Model ##
res_otr = submod_otr(Y, A, X, Xtest=X, mu_train = res.ple$mu_train)
out = predict(res_otr, newdata=X)
plot(res_otr$mod)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab