View source: R/DiscSurvLifeTable.R
| lifeTable | R Documentation |
Constructs a life table and estimates discrete hazards, survival functions, discrete cumulative hazards and their standard errors without covariates.
lifeTable(
dataShort,
timeColumn,
eventColumn,
intervalLimits = NULL,
censInterval = "middle"
)
## S3 method for class 'discSurvLifeTable'
print(x, firstRows = 5, ...)
dataShort |
Original data in short format (class "data.frame"). |
timeColumn |
Name of the column with discrete survival times (class "character"). |
eventColumn |
Gives the column name of the event indicator (1=observed, 0=censored) (class "character"). |
intervalLimits |
Optional names of the intervals for each row, e. g.
|
censInterval |
Assumption about when censoring takes places within an interval on the continuous time scale (class "character"). Possible values are "start", "middle", "end". Default is "middle". |
x |
estimated life table (class "discSurvLifeTable") |
firstRows |
Display the first number of specified rows (class "numeric"). |
... |
Specification of additional arguments in function |
The assumption of censoring times within the given intervals of argument "censInterval" estimate the hazard rate with value "start" $d_t/(n_t-w_t)$, "middle" $d_t/(n_t-w_t/2)$ and "end" $d_t/n_t$
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
Thomas Welchowski t.welchowski@psychologie.uzh.ch
Matthias Schmid matthias.schmid@imbie.uni-bonn.de
lawlessLifetimediscSurv
\insertReftutzModelDiscdiscSurv
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.