View source: R/DiscSurvEstimationCR.R
| estMeasuresCompRisks | R Documentation |
Wrapper to estimate competing risks all cause survival functions, cumulative hazards and marginal probabilities of all individuals of a given data set.
estMeasuresCompRisks(hazards, obj)
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"). |
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.
It is assumed that the data set was preprocessed with functions such as
dataLong or dataLongTimeDep.
Thomas Welchowski t.welchowski@psychologie.uzh.ch
tutzModelDiscdiscSurv
estSurv, estCumHaz,
estMargProb
# 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]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.