lifeTable: Life Table Construction and Estimates

View source: R/DiscSurvLifeTable.R

lifeTableR Documentation

Life Table Construction and Estimates

Description

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

Usage

lifeTable(dataShort, timeColumn, eventColumn, intervalLimits = NULL)

## S3 method for class 'discSurvLifeTable'
print(x, ...)

Arguments

dataShort

Original data in short format ("class data.frame").

timeColumn

Name of the column with discrete survival times ("character vector").

eventColumn

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

intervalLimits

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

x

Object of class "discSurvLifeTable"("class discSurvLifeTable")

...

Additional arguments to the print function

Value

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

  • n Number of individuals at risk in a given time interval (integer)

  • events Observed number of events in a given time interval (integer)

  • dropouts Observed number of dropouts in a given time interval (integer)

  • atRisk Estimated number of individuals at risk, corrected by dropouts (numeric)

  • hazard Estimated risk of death (without covariates) in a given time interval

  • seHazard Estimated standard deviation of estimated hazard

  • S Estimated survival curve

  • seS Estimated standard deviation of estimated survival function

  • cumHazard Estimated cumulative hazard function

  • seCumHazard Estimated standard deviation of the estimated cumulative hazard function

  • margProb Estimated marginal probability of event in time interval

Author(s)

Thomas Welchowski welchow@imbie.meb.uni-bonn.de

Matthias Schmid matthias.schmid@imbie.uni-bonn.de

References

\insertRef

tutzModelDiscdiscSurv

\insertReflawlessLifetimediscSurv

Examples


# 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(dataShort = UnempDurSubset, timeColumn = "spell", 
eventColumn = "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(dataShort = mgusInt, timeColumn= "futime", eventColumn = "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 discrete hazards")


discSurv documentation built on March 18, 2022, 7:12 p.m.