kmdiff | R Documentation |
Draw a confidence band for comparing two survival curves. The shaded region
is centered at the midpoint of the two survival estimates, and the height
is half the width of the approximate conf.int
pointwise confidence
region. Curves not overlapping the shaded area are approximately
significantly different at the 1 - conf.int
level.
kmdiff(object, col = adjustcolor("grey", 0.5), conf.int = 0.95)
object |
an object of class |
col |
color used for the band |
conf.int |
the level of the two-sided confidence interval |
Adapted from rms::survdiffplot
library('survival')
fit <- survfit(Surv(time, status) ~ sex, lung)
## survival:::plot.survfit
plot(fit, mark.time = TRUE, col = 1:2)
kmdiff(fit)
## rawr::kmplot (add = TRUE to add to plot before resetting par)
kmplot(fit, add = TRUE)
kmdiff(fit)
legend(
'topright', fill = adjustcolor('grey', 0.5),
legend = sprintf('Difference\n1/2 %s CL', fit$conf.int)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.