lifeTable: Life Table Construction and Estimates

Description Usage Arguments Value Author(s) References Examples

View source: R/DiscSurvLifeTable.R

Description

Constructs a life table and estimates discrete hazard rates, survival functions, cumulative hazard rates and their standard errors without covariates.

Usage

1
lifeTable(dataSet, timeColumn, censColumn, intervalBorders = NULL)

Arguments

dataSet

Original data in short format. Must be of class "data.frame".

timeColumn

Name of the column with discrete survival times. Must be a scalar character vector.

censColumn

Gives the column name of the event indicator (1=observed, 0=censored). Must be of type "character".

intervalBorders

Optional names of the intervals for each row, e. g. [a_0, a_1), [a_1, a_2), ..., [a_q-1, a_q)

Value

List containing an object of class "data.frame" with following columns

Author(s)

Thomas Welchowski [email protected]

Matthias Schmid [email protected]

References

Jerald F. Lawless, (2000), Statistical Models and Methods for Lifetime Data, 2nd edition, Wiley series in probability and statistics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Example with unemployment data
library(Ecdat)
data(UnempDur)

# Extract subset of all persons smaller or equal the median of age
UnempDurSubset <- subset(UnempDur, age<=median(UnempDur$age))
LifeTabUnempDur <- lifeTable (dataSet=UnempDurSubset, timeColumn="spell", censColumn="censor1")
LifeTabUnempDur

# Example with monoclonal gammapothy data
library(survival)
head(mgus)
# Extract subset of mgus
subMgus <- mgus [mgus$futime<=median(mgus$futime), ]
# Transform time in days to intervals [0, 1), [1, 2), [2, 3), ... , [12460, 12461)
mgusInt <- subMgus
mgusInt$futime <- mgusInt$futime + 1
LifeTabGamma <- lifeTable (dataSet=mgusInt, timeColumn="futime", censColumn="death")
head(LifeTabGamma$Output, 25)
plot(x=1:dim(LifeTabGamma$Output)[1], y=LifeTabGamma$Output$hazard, type="l", 
xlab="Time interval", ylab="Hazard", las=1, 
main="Life table estimated marginal hazard rates")

discSurv documentation built on May 29, 2017, 6:47 p.m.