Skip to contents

Ported from multinma::geom_km() (Phillippo et al. 2020). Returns a list of ggplot2 layers, so it can be added to an existing plot; adding it to plot_survival() overlays the observed data on the fitted survival curves.

Usage

geom_km(object, ..., curve_args = list(), cens_args = list())

Arguments

object

A cmlnmr() fit with family = "survival".

...

Passed to survival::survfit().

curve_args, cens_args

Optional lists of arguments customizing the curves (ggplot2::geom_step()) and the censoring marks (ggplot2::geom_point()).

Value

A list of ggplot2 layers.

Details

Only status 1 counts as an event; statuses 0, 2, and 3 (right, left, and interval censoring) are treated as censored for the empirical curve.

See also

Examples

if (FALSE) {
plot_survival(fit) + geom_km(fit)
}