Generates a plot of an estimated survival function S(T>t|x) based on estimated discrete hazards.
plotSurv(hazards, ...)
Estimated discrete hazards ("numeric vector")
Further arguments passed to plot
.
tutzModelDiscdiscSurv
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab