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

kaplan.meier

Kaplan-Meier Estimator using Histogram Data


Description

Compute the Kaplan-Meier estimator of a survival time distribution function, from histogram data

Usage

kaplan.meier(obs, nco, breaks, upperobs=0)

Arguments

obs

vector of n integers giving the histogram of all observations (censored or uncensored survival times)

nco

vector of n integers giving the histogram of uncensored observations (those survival times that are less than or equal to the censoring time)

breaks

Vector of n+1 breakpoints which were used to form both histograms.

upperobs

Number of observations beyond the rightmost breakpoint, if any.

Details

This function is needed mainly for internal use in spatstat, but may be useful in other applications where you want to form the Kaplan-Meier estimator from a huge dataset.

Suppose T[i] are the survival times of individuals i=1,…,M with unknown distribution function F(t) which we wish to estimate. Suppose these times are right-censored by random censoring times C[i]. Thus the observations consist of right-censored survival times T*[i] = min(T[i],C[i]) and non-censoring indicators D[i] = 1(T[i] <= C[i]) for each i.

If the number of observations M is large, it is efficient to use histograms. Form the histogram obs of all observed times T*[i]. That is, obs[k] counts the number of values T*[i] in the interval (breaks[k],breaks[k+1]] for k > 1 and [breaks[1],breaks[2]] for k = 1. Also form the histogram nco of all uncensored times, i.e. those T*[i] such that D[i]=1. These two histograms are the arguments passed to kaplan.meier.

The vectors km and lambda returned by kaplan.meier are (histogram approximations to) the Kaplan-Meier estimator of F(t) and its hazard rate lambda(t). Specifically, km[k] is an estimate of F(breaks[k+1]), and lambda[k] is an estimate of the average of lambda(t) over the interval (breaks[k],breaks[k+1]).

The histogram breaks must include 0. If the histogram breaks do not span the range of the observations, it is important to count how many survival times T*[i] exceed the rightmost breakpoint, and give this as the value upperobs.

Value

A list with two elements:

km

Kaplan-Meier estimate of the survival time c.d.f. F(t)

lambda

corresponding Nelson-Aalen estimate of the hazard rate lambda(t)

These are numeric vectors of length n.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also


spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

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