Learn R Programming

npsurv (version 0.5-0)

km: Kaplan-Meier Estimation

Description

km computes the nonparametric maximum likelihood esimate (NPMLE) of a survival function for right-censored data.

Usage

km(data, w = 1)

Arguments

data

vector or matrix, or an object of class icendata.

w

weights/multiplicities of observations.

Value

A list with components:

f

NPMLE, an object of class idf.

ll

log-likelihood value of the NPMLE f.

Details

For details about the arguments, see icendata.

References

Kaplan, E. L. and Meier, P. (1958). Nonparametric estimation from incomplete observations. Journal of the American Statistical Association, 53, 457-481.

See Also

icendata, npsurv, idf.

Examples

Run this code
# NOT RUN {
x = cbind(1:5, c(1,Inf,3,4,Inf))
(f = km(x)$f)
plot(f)

data(leukemia)
i = leukemia[,"group"] == "Placebo"
plot(km(leukemia[i,1:2])$f, xlim=c(0,40), col="green3") # placebo
plot(km(leukemia[!i,1:2])$f, add=TRUE)                  # 6-MP

# }

Run the code above in your browser using DataLab