Learn R Programming

StratifiedMedicine (version 0.1.3)

predict.submod_train: Subgroup Identification: Train Model (Predictions)

Description

Prediction function for the trained subgroup identification model (submod).

Usage

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

Arguments

object

Trained submod 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 (depends on subgroup model)

  • Subgrps - Identified subgroups

  • pred - Predictions, depends on subgroup model

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

# Fit submod_lmtree directly #
mod1 = submod_lmtree(Y, A, X, Xtest=X)
out1 = predict(mod1)
plot(mod1$mod)

# Fit through submod_train wrapper #
mod2 = submod_train(Y=Y, A=A, X=X, Xtest=X, submod="submod_lmtree")
out2 = predict(mod2)
plot(mod2$fit$mod)

# }

Run the code above in your browser using DataLab