Learn R Programming

RCASPAR (version 1.18.0)

kmplt_svrl: A function that plots the KM curves of $2-3$ patient sets in one graph.

Description

This function can plot the KM curves estimated for $2-3$ patients simultaneously for sake of easier comparison.

Usage

kmplt_svrl(all, long, short, title)

Arguments

all
Data for the first set of patients; usually the complete set of patients, but could be any other.It is a data frame containing at least the two columns ``censored'' and ``True_STs''. Where ``censored'' contains the censorship status of the subject as either ``0/F'' for uncensored subjects or ``1/T'' for censored subjects. This information is essential to be able to plot the KM curve.
long
Data for the second set of patients; in our case the group of patients who survived at least up to the cut off value passed to the predictor. It has essentially the same structure as “all”
short
Data for the third and last set of patients; in our case the group of patients who survived less than the cut off value passed on to the predictor. It essentially has the same structure as the two other arguments.
title
The main title for the plot.

Value

A plot with all $2-3$ KM curves.

Details

This function essentially is the same as kmplt but does the same for up to $3$ plots simultaneously.

References

http://www.bmj.com/statsbk/12.dtl

See Also

kmplt

Examples

Run this code
censored <- c(1, 0, 1, 1, 1, 0, 1, 0, 0, 0)
True_STs <- c(1, 4, 5, 4, 6, 3, 2, 1, 3, 4)
dat1 <- as.data.frame(cbind(True_STs, censored))
censored <- c(1, 0, 1, 0, 1, 0, 1, 0, 1, 1)
True_STs <- c(7, 7, 8, 5, 9, 11, 8, 11, 10, 6)
dat2 <- as.data.frame(cbind(True_STs, censored))
censored <- c(1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1)
True_STs <- c(1, 4, 5, 4, 6, 3, 2, 1, 3, 4, 7, 7, 8, 5, 9, 11, 8, 11, 10, 6)
dat3 <- as.data.frame(cbind(True_STs, censored))
kmplt_svrl(all=dat3, long=dat2, short=dat1, title="KM of predictions")           

Run the code above in your browser using DataLab