plotSurv {discSurv} | R 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 |
Author(s)
Moritz Berger moritz.berger@imbie.uni-bonn.de
https://www.imbie.uni-bonn.de/personen/dr-moritz-berger/
References
Tutz G, Schmid M (2016). Modeling discrete time-to-event data. Springer Series in Statistics.
See Also
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)
[Package discSurv version 2.0.0 Index]