Learn R Programming

kaps (version 0.9-2)

lrtree: Recursive partitioning for censored survival data by log-rank test

Description

Conduct recursive partitioning algorithm for censored survival data by log-rank related tests.

Usage

lrtree(Formula, data, subset = NULL, weights = NULL, ...)

Arguments

Formula
an object with the type of Formula, with the response of the left hand side of the '~' operator, and the covariate terms on the right side. The response have be a survival object with survival time and censoring status by Surv. See
data
a dataset with variables used in Formula. It needs at least three variables including survival time, censoring status, and a covariate. The structure of this object is data.frame.
subset
an optional vector to be used as a subset of observations.
weights
an optional vector to be used as a weight parameter.
...
a S4 class object specifying minior parameters for lrtree() using lrtree.control

See Also

km.curve, labels, plot, show, summary, text for the convenient use of lrtree lrtree.control to control lrtree more detail kaps, apss.control for counterpart of the lrtree

Examples

Run this code
## 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