Learn R Programming

StratifiedMedicine (version 0.2.3)

submod_train: Subgroup Identification: Train Model

Description

Wrapper function to train a subgroup model (submod). Used directly in PRISM and can be used to directly fit a submod model by name.

Usage

submod_train(Y, A, X, Xtest, mu_train = NULL, family = "gaussian",
  submod, hyper = NULL, ...)

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

mu_train

Patient-level estimates (See PLE_models). Default=NULL

family

Outcome type ("gaussian", "binomial", "survival"). Default="gaussian".

submod

Subgroup identification (submod) function. Maps the observed data and/or PLEs to subgroups.

hyper

Hyper-parameters for submod (must be list). Default is NULL.

...

Any additional parameters, not currently passed through.

Value

Trained subgroup model and subgroup predictions/estimates for train/test sets.

  • mod - trained subgroup model

  • Subgrps.train - Identified subgroups (training set)

  • Subgrps.test - Identified subgroups (test set)

  • pred.train - Predictions (training set)

  • pred.test - Predictions (test set)

  • Rules - Definitions for subgroups, if provided in fitted submod output.

See Also

PRISM

Examples

Run this code
# NOT RUN {
# }
# 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)
plot(mod1$mod)

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

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab