Last data update: 2014.03.03

R: A function that plots the KM curves of $2-3$ patient sets in...
kmplt_svrlR Documentation

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.

Details

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

Value

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

Author(s)

Douaa Mugahid

References

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

See Also

kmplt

Examples

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")           

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RCASPAR)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/RCASPAR/kmplt_svrl.Rd_%03d_medium.png", width=480, height=480)
> ### Name: kmplt_svrl
> ### Title: A function that plots the KM curves of $2-3$ patient sets in one
> ###   graph.
> ### Aliases: kmplt_svrl
> ### Keywords: Kaplan-Meier estimator
> 
> ### ** Examples
> 
> 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")           
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>