Overview

Description

Plot empirical survival functions using the Kaplan-Meier estimator.

Usage

Arguments

r
a data frame with a column id, a column time, a column with values and possibly a column group.
index
an integer: index=k means that the survival function for the k-th event is displayed. Default is index=1.
level
a number between 0 and 1: confidence interval.
time
a vector of time points where the survival function is evaluated.
cens
display censoring times TRUE/FALSE (default=TRUE).
plot
plot the estimated survival function TRUE/FALSE (default=TRUE)
color
color to be used for the plots (default=“#e05969”).
group
variable to be used for defining groups (by default, group is used when it exists).
facet
makes subplots for different groups TRUE/FALSE (default=TRUE)
labels
vector of strings.

Value

a ggplot object if plot=TRUE. Otherwise, a list with fields:
surv
a data frame with columns T (time), S (survival), possibly (S1, S2) (confidence interval) and possibly group,
cens
a data frame with columns T0 (time), S0 (survival) and possibly group.


Examples

Single event

Survival function

We simulate a single event for \(N=100\) individuals using a Weibull model. Here, the time to event is exactly known.

## [INFO] The lixoftConnectors package has been successfully initialized:
## lixoftConnectors package version -> 2019.1
## Lixoft softwares suite version   -> 2019R1

Compute and display the empirical estimate of the survival function:


Confidence interval

Display a \(90\%\) confidence interval: