View source: R/autoplot.survfitr.R
| autoplot.survfitr | R Documentation |
Draws the estimated survival function of a survfitr object as a step
function, one colour per group, with an optional pointwise confidence
band. The cumulative distribution (fun = "event") and the cumulative
hazard (fun = "cumhaz") transformations are also available.
## S3 method for class 'survfitr'
autoplot(
object,
fun = c("surv", "event", "cumhaz"),
conf.int = TRUE,
level = 0.95,
conf.type = c("log-log", "plain"),
...
)
object |
an object of class |
fun |
transformation of the survival curve: |
conf.int |
draw the pointwise confidence band? Default |
level |
confidence level of the band. |
conf.type |
transformation used for the band: |
... |
ignored; kept for compatibility with the generic. |
The confidence band is computed from the standard errors of the fit
when the estimator provides them (Peña-Strawderman-Hollander and
Wang-Chang). With conf.type = "log-log" (default) the limits are
obtained on the \log(-\log S) scale, so they always stay inside
[0, 1]; "plain" gives the symmetric limits of the base
plot.survfitr() method.
A ggplot object, which can be further styled with the usual
ggplot2 syntax.
plot.survfitr() for the base-graphics version,
plotEstimators() to compare the three estimators,
theme_survrec()
data(MMC)
fit <- survfitr(Survr(id, time, event) ~ group,
data = MMC,
type = "wang-chang"
)
autoplot(fit)
autoplot(fit, fun = "cumhaz", conf.int = FALSE)
# it is a ggplot, so it can be restyled
autoplot(fit) + ggplot2::labs(title = "Migratory Motor Complex")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.