pecRpart: Predict survival based on rpart tree object

View source: R/predictSurvProb.R

pecRpartR Documentation

Predict survival based on rpart tree object

Description

Combines the rpart result with a stratified Kaplan-Meier (prodlim) to predict survival

Usage

pecRpart(formula, data, ...)

Arguments

formula

passed to rpart

data

passed to rpart

...

passed to rpart

Value

list with three elements: ctree and call

Examples

library(prodlim)
if (!requireNamespace("rpart",quietly=TRUE)){
library(rpart)
library(survival)
set.seed(50)
d <- SimSurv(50)
nd <- data.frame(X1=c(0,1,0),X2=c(-1,0,1))
f <- pecRpart(Surv(time,status)~X1+X2,data=d)
predictSurvProb(f,newdata=nd,times=c(3,8))
}

pec documentation built on April 11, 2023, 5:55 p.m.

Related to pecRpart in pec...