VisualiseCoxModel.RdVisualiseCoxModel produces a plot of time to event curves for specified scenario values of covariates in a COX models.
VisualiseCoxModel(DFR, SURV, SCENARIOS, COMBINE = F, LEGEND = T, STAT = "MEDIAN", TIMEPOINT = NULL, SORT_CURVES = T, LINE = T, MAIN = NULL, XLAB = NULL, YLAB = NULL, XLIM = NULL, XAXP = NULL, YLIM = c(0, 1), YAXP = c(0, 1, 10), LWD = 1, UNIT = NULL, SHORTNAMES = NULL, RATIO = 1/3, XPAD = 0.2)
| DFR | data.frame containing the time to event variable (as Surv object) and the covariates named in the columns of the SCENARIOS data frame. |
|---|---|
| SURV | name of the Surv object of the time to event endpoint in DFR |
| SCENARIOS | a named list or data.frame specifing values of the covariate for which curves are to be plotted. Names MUST correspond to Colnames of DFR. The Cox model is SURV ~ names(SCENARIOS) |
| COMBINE | =F, if TRUE curves are plotted for ALL combinations of values specified in columns of SCENARIOS. If FALSE only scenarios corresponding to rows in SCENARIOS are plotted. In this case SCENARIOSmust be a data.frame or a list the same length components. |
| LEGEND | =T, show various statistics on the right outside the plot. |
| STAT | ="MEDIAN", show a table with MEDIANs or RATEs for all curves plotted. For RATEs TIMEPOINT must be specified. |
| TIMEPOINT | =NULL, time point at which the rates are read off. |
| SORT_CURVES | =T, sort the medians respectively rates in the legend table? |
| LINE | =T, dotted horizontal line at 50 percent for MEDIAN or dotted vertical line to show the RATEs time point |
| MAIN | =NULL, plot title default is Visualisation COX model |
| XLAB | =NULL, x-axis label, default is "Time" with UNITS added in brackets if UNITS specified |
| YLAB | =NULL, y-axis label, default is "Proportion event free" |
| XLIM | =NULL, range of x-axis |
| XAXP | =NULL, control on ticks on x-axis |
| YLIM | =c(0,1), range of y-axis |
| YAXP | =c(0,1,10), ticks on y-axis |
| LWD | =1, line width for time to event curves |
| UNIT | =NULL, specify time unit to beincluded in XLAB, e.g. "days", "Months", "years" |
| SHORTNAMES | =NULL, provide alternative names for the covariates in SCENARIOS to be used in legend tables. |
| RATIO | =1/3, control the width ratio bewteen the plot and the legend. |
| XPAD | =0.2, control distance between columns of the legend table |
produces a plot and returns dataframe with MEDIAN respectively RATE estimates
if (FALSE) { DAT<-ovarian DAT[,"SURV"]<-Surv(DAT[,"futime"], DAT[,"fustat"]) SCENARIOS<-list(age=c(60,70),rx=c(1,2),ecog.ps=c(1.2)) VisualiseCoxModel(DAT,"SURV",SCENARIOS,LEGEND=T) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=T,LEGEND=F) ## make a data.frame with all combinations to be used with COMBINE=F SCENARIOS<-data.frame(age=c(60,70),rx=c(1,2),ecog.ps=c(1,2)) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=F,LEGEND=T) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=T,LEGEND=T,RATIO=1/2, XLIM=c(0,800),XAXP=c(0,1000,10)) SCENARIOS<-list(rx=c(1,2),age=c(50,60,65,70),ecog.ps=c(1,2)) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=F,LEGEND=T,UNIT="days") VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=T,LEGEND=T,LWD=3, STAT="RATE",TIMEPOINT=400,YLIM=c(0.3,1),YAXP=c(.3,1,7)) SCENARIOS<-list(age=seq(40,80,5)) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=F,LEGEND=T) VisualiseCoxModel(DAT,"SURV",SCENARIOS,COMBINE=F,LEGEND=T, STAT="RATE",TIMEPOINT=400) }