| plot_survival | R Documentation |
Plot KM curve with right censoring data or the survival curve of a fitted piecewise exponential model.
## Default S3 method:
plot_survival(time, event, add=FALSE, conf.int=FALSE, mark.time=TRUE,
lwd=2, xlab='Follow-up time', ylab='Survival function', ...)
## S3 method for class 'pwexp.fit'
plot_survival(time, add=TRUE, show_breakpoint=TRUE,
breakpoint_par=NULL, ...)
## S3 method for class 'boot.pwexp.fit'
plot_survival(time, add=TRUE, alpha=0.1, show_breakpoint=TRUE,
breakpoint_par=NULL, show_CI=TRUE, CI_par=NULL, ...)
time |
observed time from randomization or a |
event |
the status indicator, normally 0=censor, 1=event. Other choices are TRUE/FALSE (TRUE = event). |
add |
logical; if TRUE add lines to current plot. |
show_breakpoint |
logical; if TRUE add vertial dashed lines to indicate breakpoints. |
breakpoint_par |
a list of parameters to control the apperance of vertical lines of breakpoionts. The values pass to |
alpha |
the significance level of the confidence interval. |
show_CI |
logical; if TRUE add confidence interval of the estimated curve. For KM esitmator, use |
CI_par |
a list of parameters to control the apperance of lines of confidence intervals. The values pass to |
conf.int |
determines whether pointwise confidence intervals will be plotted. Passed over to |
mark.time |
controls the labeling of the curves. Passed over to |
lwd |
line width of the KM curve. |
xlab |
x label. |
ylab |
y label. |
... |
other arguments are passed over to |
For the default method, this a wrapper of plot.survfit function to plot right censoring data.
For class pwexp.fit, parameters in ... are passed to plot function to control the appearance of the survival curve; parameters in breakpoint_par are passed to abline function to control the appearance of vertical lines of breakpoints. See examples for usage.
For class boot.pwexp.fit, parameters in ... are passed to plot function to control the appearance of the survival curve; parameters in breakpoint_par are passed to abline function to control the appearance of vertical lines of breakpoints; parameters in CI_par are passed to lines function to control the appearance of confidence intervals. See examples for usage.
No return value.
Tianchen Xu zjph602xutianchen@gmail.com
plot_event
event_dist <- function(n)rpwexp(n, rate = c(0.1, 0.01, 0.2), breakpoint = c(5,14))
dat <- simdata(rand_rate = 20, drop_rate = 0.03, total_sample = 1000,
advanced_dist = list(event_dist=event_dist),
add_column = c('censor_reason','event','followT','followT_abs'))
plot_survival(dat$followT, dat$event, xlim=c(0,40))
fit_res <- pwexp.fit(dat$followT, dat$event, nbreak = 2)
plot_survival(fit_res, col='red', lwd=3, breakpoint_par = list(col='grey', lwd=2.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.