plotSurv: Plot Estimated Survival Function

plotSurvR Documentation

Plot Estimated Survival Function

Description

Generates a plot of an estimated survival function S(T>t|x) based on estimated discrete hazards.

Usage

plotSurv(hazards, ...)

Arguments

hazards

Estimated discrete hazards ("numeric vector")

...

Further arguments passed to plot.

Author(s)

Moritz Berger moritz.berger@imbie.uni-bonn.de
https://www.imbie.uni-bonn.de/personen/dr-moritz-berger/

References

\insertRef

tutzModelDiscdiscSurv

See Also

estSurv

Examples

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

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

# Convert to long format
UnempLong <- dataLong(dataShort = subUnempDur, timeColumn = "spell", eventColumn = "censor1")
head(UnempLong)

# Estimate binomial model with logit link
Fit <- glm(formula = y ~ timeInt + age + logwage, data = UnempLong, family = binomial())

# Estimate discrete survival function given age, logwage of first person
Tmax   <- max(subUnempDur$spell)
UnempEval <- dataLong(dataShort = UnempDur[1,], timeColumn = "spell", eventColumn = "censor1", 
aggTimeFormat = TRUE, lastTheoInt = Tmax)
hazard <- predict(Fit, newdata = UnempEval, type = "response")

plotSurv(hazard)




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