View source: R/DiscSurvEstimation.R
| estMeasures | R Documentation |
Wrapper to estimate survival functions, cumulative hazards and marginal probabilities of all individuals of a given data set.
estMeasures(hazards, obj)
hazards |
Estimated hazards of the event (class "numeric"). |
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 List of estimated survival curves for each individual.
cumHaz List of estimated cumulative hazards for each individual.
margProb List of estimated 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 hazard rates
estRegModel <- estReg(dataShort = subUnempDur, dataTransform = "dataLong",
formulaVariable =~ timeInt + age + ui + logwage * ui,
eventColumn = "censor1", timeColumn = "spell")
estHaz <- predict(estRegModel, type="response")
######################
# Single event example
# Estimate all survival functions of a given data set
measures1 <- estMeasures(hazards=estHaz,
obj=attr(estRegModel, "augData")$obj)
# Survival function of first individual
measures1$surv[[1]]
# Cumulative hazard of first individual
measures1$cumHaz[[1]]
# Marginal probabilities of first individual
measures1$margProb[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.