estMeasuresCompRisks: Fit Discrete Survival Measures Based On Cause-Specific...

View source: R/DiscSurvEstimationCR.R

estMeasuresCompRisksR Documentation

Fit Discrete Survival Measures Based On Cause-Specific Hazards

Description

Wrapper to estimate competing risks all cause survival functions, cumulative hazards and marginal probabilities of all individuals of a given data set.

Usage

estMeasuresCompRisks(hazards, obj)

Arguments

hazards

Estimated discrete hazards of the events (numeric class c("matrix", "array")). Discrete hazards of each time interval are stored in the rows and the number of columns equal to the number of events.

obj

Integer identification number of each individual. Usually this information is computed during data augmentation (class "numeric").

Value

List of estimated measures (class "list"). There are three list elements with following contents:

  • surv_a List of estimated all cause survival curves for each individual.

  • cumHaz_a List of estimated all cause cumulative hazards for each individual.

  • margProb_a List of estimated all cause marginal probabilities for each individual.

Note

It is assumed that the data set was preprocessed with functions such as dataLong or dataLongTimeDep.

Author(s)

Thomas Welchowski t.welchowski@psychologie.uzh.ch

References

\insertRef

tutzModelDiscdiscSurv

See Also

estSurv, estCumHaz, estMargProb

Examples


# Load unemployment data
library(Ecdat)
data(UnempDur)

# Select subsample
subUnempDur <- UnempDur[1:100, ]

######################################
# Estimate cause-specific hazard rates

estModel <- estRegSmoothCompRisks(dataShort = subUnempDur, dataTransform = "dataLongCompRisks", 
formulaVariable =~ timeInt + age + ui + logwage * ui, 
eventColumns = c("censor1", "censor2", "censor3", "censor4"), timeColumn = "spell")

# Estimate cause-specific hazards (without censoring "e0")
estHaz <- predict(estModel, type="response")[, -1]

######################
# Single event example

# Estimate all survival functions of a given data set
measures1CompRisks <- estMeasuresCompRisks(hazards=estHaz, 
obj=attr(estModel, "augData")$obj)

# All cause survival function of first individual
measures1CompRisks$surv_a[[1]] 

# All cause cumulative hazard of first individual
measures1CompRisks$cumHaz_a[[1]]

# All cause marginal probabilities of first individual
measures1CompRisks$margProb_a[[1]]


discSurv documentation built on April 29, 2026, 9:07 a.m.