Produces a time to event "survival plot" with many optional information outside the plot margins

NiceSurvPlot(Times, Status = NULL, Groups = NULL, ArmLabels = NULL,
  ArmCols = NULL, ByLineType = FALSE, CensTicks = TRUE, Main = "",
  AnalysisString = "", Xlab = NULL, Ylab = "proportion event free",
  Scale = 12, Unit = "months", Ylim = c(0, 1), Timepoint = 12,
  MaxTime = NULL, OrderByPlateau = TRUE, NriskBelow = TRUE,
  Estimates = TRUE, CIplot = FALSE, Medians = FALSE,
  CompareLogrank = TRUE, LHRestimate = NULL, YreferenceLine = NULL,
  XreferenceLine = NULL)

Arguments

Times

EITHER Time to event variable of class "Surv" OR time component of time to event

Status

=NULL status component von time to event (needed only if Times is not of class "Surv")

Groups

=NULL grouping variable; if NULL a single curve is plotted with confdence band (set ArmCols=c(1,0,0) to suppress it )

ArmLabels

=NULL, Specify Arm labels - if NULL: levels(Groups) ATTENTION: up to 10 characters!

ArmCols

=NULL, Specify colour code - if NULL a standard is used

ByLineType

=FALSE, black curves distinguished by LineType - ignore ArmCols

CensTicks

=TRUE, show censoring ticks - better set to FALSE to show LineTypes

Main

="", plot title

AnalysisString

="", CharacterString to be plotted bottomright

Xlab

=NULL, set x-axis label manually instead of automatically

Ylab

="proportion event free", Specifiy y axis label

Scale

=12, Time Unit for time axis

Unit

="months", Time Unit name

Ylim

=c(0,1), specify range y-axis, if lower > 0 this is marked on the plot

Timepoint

=12, Time point to sort curves, provide rate estimates, and plot CIs

MaxTime

=NULL, Restrict time axis to MaxTime, later events still count in tests etc

OrderByPlateau

=TRUE, Order legend by decreasing order of curves at timepoint

NriskBelow

=TRUE, Show Nrisk numbers below plot at ticks

Estimates

=TRUE Show legend with rate estimates at timepoint with 95 percent CI

CIplot

= FALSE plot with 95 percent CIs at Timepoint

Medians

=FALSE, show legend with median estimates with 95 percent CI - if(Medians) Estimates set to FALSE

CompareLogrank

=TRUE, compare groups with logrank test and show p.value

LHRestimate

=NULL, Estimate of log hasard ratio Group first mentioned in legend as reference

YreferenceLine

=NULL, Horizontal reference line at (possibly a vector)

XreferenceLine

=NULL, Vertical reference line at (possibly avector)

Value

produces a plot (choose: width:height 3:2) and returns an invisible list with components: missing = selector for missing observations, KMtable Kaplan-Meier table, model summary of Coxmodelfit, Rates Rate estimates at Timepoint, Medians with Median estimates

Examples

if (FALSE) { require(MASS) ## Set wide Window to about 3 x 2 NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$celltype, Medians=T,Scale=180,Unit = "Days",Xlab="OSV",Timepoint = 360) VA$Karnvsky<-factor(VA$Karn) levels(VA$Karnvsky)<-c("10-40","10-40","10-40","10-40","50-74","50-74", "50-74","50-74","75-100","75-100","75-100","75-100") NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$Karnvsky, Medians=T,Scale=180,Unit = "Days",Xlab="OSV",Timepoint = 60, OrderByPlateau = F, AnalysisString="NiceSurvPlot Demo",Main="OSV by Karnvsky") NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$Karnvsky, Medians=T,Scale=180,Unit = "Days",Timepoint = 180,OrderByPlateau = T) NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$Karnvsky, Medians=F,Scale=180,Unit = "Days",Xlab="OSV",Timepoint = 180, OrderByPlateau = T, AnalysisString="NiceSurvPlot Demo",ByLineType = T) NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$treat, Medians=T,Scale=180,Unit = "Days",Xlab="OSV [Days]",Timepoint = 180, OrderByPlateau = T, AnalysisString="NiceSurvPlot Demo") NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$treat, Medians=T,Scale=180,Unit = "Days",Xlab="OSV [Days]",Timepoint = 180, OrderByPlateau = T, AnalysisString="NiceSurvPlot Demo",ArmLabels = c("standard","test")) NiceSurvPlot(Times=VA$stime,Status=VA$status,Groups=VA$treat, Medians=F,Scale=60,MaxTime = 540,Unit = "Days",Xlab="OSV [Days]", Timepoint = 180,OrderByPlateau = T,AnalysisString ="NiceSurvPlot Demo", ArmLabels = c("standard","test"),ArmCols = c(4,6)) }