Skip to contents

Recursive Partitioning Analysis (RPA) for survival data using CART methodology. Builds a decision tree to identify optimal cut-points for risk stratification. Automatically performs cross-validation and tree pruning. Creates new variable with risk group assignments. Useful for developing prognostic staging systems by integrating multiple predictors.

Usage

rpasurvival(
  data,
  time,
  event,
  predictors,
  eventValue = "1",
  time_unit = "months",
  minbucket = 20,
  cp = 0.01,
  maxdepth = 3,
  nfolds = 10,
  prunetree = TRUE,
  riskgrouplabels = "auto",
  treeplot = TRUE,
  kmplot = TRUE,
  kmci = FALSE,
  risktable = TRUE,
  pval = TRUE,
  riskgrouptable = TRUE,
  cptable = FALSE,
  variableimportance = TRUE,
  createnewvar = FALSE,
  newvarname = "rpa_stage",
  showSummary = TRUE,
  showInterpretation = FALSE,
  showReport = TRUE
)

Arguments

data

.

time

a (non-negative valued) vector of survival times containing the (possibly censored) time to the event or time of last observation

event

the status indicator; normally 0=alive/censored, 1=dead/event. Other choices are TRUE/FALSE (TRUE = death/event) or 1/2 (2=death/event)

predictors

variables to use in recursive partitioning analysis for developing risk stratification groups

eventValue

the value in the event variable that represents an event (death/failure)

time_unit

unit of measurement for survival time. Used for calculating 5-year survival estimates in the risk group summary table.

minbucket

the minimum number of observations in any terminal (leaf) node. Smaller values create more detailed trees but may overfit.

cp

any split that does not decrease overall lack of fit by a factor of cp is not attempted. Smaller values grow larger trees.

maxdepth

maximum depth of any node of the final tree, with the root node counted as depth 0. Values greater than 30 are unlikely.

nfolds

number of cross-validation folds for pruning the tree. Use 0 to suppress cross-validation.

prunetree

prune the tree using cross-validation to select optimal complexity parameter

riskgrouplabels

labeling scheme for terminal nodes (risk groups)

treeplot

.

kmplot

.

kmci

.

risktable

.

pval

.

riskgrouptable

.

cptable

.

variableimportance

.

createnewvar

.

newvarname

name for the new variable containing RPA stage assignments

showSummary

.

showInterpretation

.

showReport

.

Value

A results object containing:

results$instructionsa html
results$summarya html
results$interpretationa html
results$reporta html
results$treeplotDecision tree showing recursive partitioning splits for survival risk stratification
results$riskgrouptablea table
results$kmplotKaplan-Meier survival curves stratified by RPA-derived risk groups
results$logranktesta table
results$cptablea table
results$varimpa table
results$coxmodela table
results$noticesa html

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$riskgrouptable$asDF

as.data.frame(results$riskgrouptable)