Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

KaplanMeier

Kaplan-Meier estimator


Description

Computes the Kaplan-Meier estimator for the survival function of right censored data.

Usage

KaplanMeier(x, data, censored, conf.type="plain", conf.int = 0.95)

Arguments

x

Vector with points to evaluate the estimator in.

data

Vector of n observations.

censored

Vector of n logicals indicating if an observation is right censored.

conf.type

Type of confidence interval, see survfit.formula. Default is "plain".

conf.int

Confidence level of the two-sided confidence interval, see survfit.formula. Default is 0.95.

Details

We consider the random right censoring model where one observes Z = \min(X,C) where X is the variable of interest and C is the censoring variable.

This function is merely a wrapper for survfit.formula from survival.

This estimator is only suitable for right censored data. When the data are interval censored, one can use the Turnbull estimator implemented in Turnbull.

Value

A list with following components:

surv

A vector of length length(x) containing the Kaplan-Meier estimator evaluated in the elements of x.

fit

The output from the call to survfit.formula, an object of class survfit.

Author(s)

Tom Reynkens

References

Kaplan, E. L. and Meier, P. (1958). "Nonparametric Estimation from Incomplete Observations." Journal of the American Statistical Association, 53, 457–481.

See Also

Examples

data <- c(1, 2.5, 3, 4, 5.5, 6, 7.5, 8.25, 9, 10.5)
censored <- c(0, 1, 0, 0, 1, 0, 1, 1, 0, 1)

x <- seq(0, 12, 0.1)

# Kaplan-Meier estimator
plot(x, KaplanMeier(x, data, censored)$surv, type="s", ylab="Kaplan-Meier estimator")

ReIns

Functions from "Reinsurance: Actuarial and Statistical Aspects"

v1.0.10
GPL (>= 2)
Authors
Tom Reynkens [aut, cre] (<https://orcid.org/0000-0002-5516-5107>), Roel Verbelen [aut] (R code for Mixed Erlang distribution, <https://orcid.org/0000-0002-2347-9240>), Anastasios Bardoutsos [ctb] (Original R code for cEPD estimator), Dries Cornilly [ctb] (Original R code for EVT estimators for truncated data), Yuri Goegebeur [ctb] (Original S-Plus code for basic EVT estimators), Klaus Herrmann [ctb] (Original R code for GPD estimator)
Initial release
2020-05-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.