KM.plot | R Documentation |
This function creates Kaplan-Meier plot.
KM.plot(Stime, survival, max.T=NULL, lty=NULL, all=TRUE, ...)
Stime |
unique ordered event times |
survival |
estimates of survival probabilities at Stime |
max.T |
maximum time to be considered for plotting, default is NULL which plots survival till max(Stime)+1 units |
lty |
line type |
all |
TRUE or FALSE, default is TRUE |
... |
additional plot arguments |
This function creates Kaplan-Meier plot. If all=TRUE, then this creates a new plot. If all=FALSE, it adds line to an existing plot and hence must be called after a plot() or similar call.
Patrick J. Heagerty
Heagerty, P.J., Zheng Y. (2005) Survival Model Predictive Accuracy and ROC curves Biometrics, 61, 92 – 105
data(pbc) ## considering only randomized patients pbc1 <- pbc[1:312,] ## create new censoring variable combine 0,1 as 0, 2 as 1 survival.status <- ifelse( pbc1$status==2, 1, 0) survival.time <- pbc1$fudays kout <- weightedKM(Stime=survival.time, status=survival.status) KM.plot(kout$time,kout$survival)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.