Learn R Programming

mets (version 1.3.11)

km: Kaplan-Meier with Robust Standard Errors

Description

Computes Kaplan-Meier estimates with robust standard errors. Robust variance is the default and is obtained from the predict call.

Usage

km(formula, data = data, km = TRUE, ...)

Value

An object of class "km" (extends "predictphreg") containing:

surr

Survival probabilities.

se.surv

Standard errors.

lower, upper

Confidence intervals.

Arguments

formula

Formula with 'Surv' or 'Event' outcome.

data

Data frame.

km

Logical; if TRUE, returns Kaplan-Meier estimates; otherwise returns Nelson-Aalen based estimates.

...

Additional arguments passed to phreg.

Author

Thomas Scheike

Examples

Run this code
data(sTRACE)
sTRACE$cluster <- sample(1:100, 500, replace = TRUE)
out1 <- km(Surv(time, status == 9) ~ strata(vf, chf), data = sTRACE)
out2 <- km(Surv(time, status == 9) ~ strata(vf, chf) + cluster(cluster), data = sTRACE)

summary(out1, times = 1:3)
summary(out2, times = 1:3)

par(mfrow = c(1, 2))
plot(out1, se = TRUE)
plot(out2, se = TRUE)

Run the code above in your browser using DataLab