km: Kaplan-Meier Survivor Curves

Description Usage Arguments Value Author(s) See Also Examples

Description

km calculates the Kaplan-Meier estimates for survival.

To plot the survivor curve, use plot(); for the empirical intensity curve, use plot.intensity(); for diagnostic curves to choose a distribution to which the data might belong, use plot.dist().

Usage

1
2
3
4
5
6
7
8
km(times, censor, group=1, freq=1, cdf=FALSE)
## S3 method for class 'km'
plot(x, add=FALSE, xlim=NULL, ylim=c(0,1), 
main=NULL, xlab="Time", ylab=NULL, lty=NULL, ...)
## S3 method for class 'km'
plot.intensity(x, add=FALSE, xlab="Time", ylab="Hazard", type="l", lty=NULL, ...)
## S3 method for class 'km'
plot.dist(x, ...)

Arguments

times

Vector of times to events or a list of vectors of such times for different individuals.

censor

Vector of censoring indicators corresponding to the vector of times or to the last time in each vector of a list.

group

Vector indicating to which group each individual belongs.

freq

Vector of frequencies for grouped data.

cdf

If TRUE, calculate the cdf instead of the survivor curve.

x

An object produced by km.

add

Plotting control options.

main

Plotting control options.

type

Plotting control options.

ylab

Plotting control options.

xlab

Plotting control options.

xlim

Plotting control options.

ylim

Plotting control options.

lty

Plotting control options.

...

Plotting control options.

Value

A matrix with class, km, containing the Kaplan-Meier estimates is returned.

Author(s)

J.K. Lindsey

See Also

plot.intensity, plot.surv

Examples

1
2
3
4
5
6
7
surv <- rgamma(40,2,scale=5)
cens <- rbinom(40,1,0.9)
treat <- gl(2,20)
plot(km(surv, cens, group=treat), main="",xlab="Months",
	ylab="Probability of deterioration")
plot.dist(km(surv, cens, group=treat))
plot.intensity(km(surv, cens, group=treat),ylab="Risk of deterioration")

Example output

Loading required package: rmutil

Attaching package:rmutilThe following object is masked frompackage:stats:

    nobs

The following objects are masked frompackage:base:

    as.data.frame, units

event documentation built on May 2, 2019, 4:07 a.m.

Related to km in event...