submod_rpart: Subgroup Identification: CART (rpart)

Description Usage Arguments Value References Examples

View source: R/submod_rpart.R

Description

Uses the CART algorithm (rpart) to identify subgroups. Usable for continuous and binary outcomes. Option to use the observed outcome or PLEs for subgroup identification.

Usage

1
2
submod_rpart(Y, A, X, Xtest, mu_train, minbucket = floor(dim(X)[1] *
  0.1), maxdepth = 4, outcome_PLE = FALSE, family = "gaussian", ...)

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)

minbucket

Minimum number of observations in a tree node. Default = floor( dim(train)[1]*0.05 )

maxdepth

Maximum depth of any node in the tree (default=4)

outcome_PLE

If TRUE, use PLE as outcome (mu_train must contain PLEs). Else use observed outcome Y

family

Outcome type ("gaussian", "binomial"), default is "gaussian"

...

Any additional parameters, not currently passed through.

Value

Trained rpart (CART).

References

Breiman L, Friedman JH, Olshen RA, and Stone CJ. (1984) Classification and Regression Trees. Wadsworth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(StratifiedMedicine)

## Continuous ##
dat_ctns = generate_subgrp_data(family="gaussian")
Y = dat_ctns$Y
X = dat_ctns$X
A = dat_ctns$A

require(rpart)
res_rpart1 = submod_rpart(Y, A, X, Xtest=X)
res_rpart2 = submod_rpart(Y, A, X, Xtest=X, maxdepth=2, minbucket=100)
plot(res_rpart1$mod)
plot(res_rpart2$mod)

StratifiedMedicine documentation built on March 1, 2020, 9:07 a.m.