## toy example
data(toy)
f <- Surv(time, status) ~ meta
fit <- lrtree(f, data = toy, eps = 1)
### Print lrtree object
fit
### Print survival median time, 1 years, 3 years, and 5 years times.
summary(fit)
### Plot tree diagram
plot(fit) # type = "naive"
#plot(fit, type = "km") # survival curves for terminal nodes
### determination of the tree size by cost-complexity pruning (0SE)
#fit1 <- prune(fit)
#fit1
### Plot Kaplan-Meire survival curves for terminal nodes.
#km.curve(fit1)
#legend(120,0.6, col=c(1:6), lwd=2,
# c("Node 2 (0 <= # of meta lymphs < 1)",
# "Node 3 (1 <= # of meta lymphs)"),
# bty="n")
# with Bootstrap stopping rule
#fit1 <- lrtree(f, data = toy, B= 20)Run the code above in your browser using DataLab