Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

discSurv (version 2.0.0)

plotSurv: 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.

References

tutzModelDiscdiscSurv

See Also

estSurv

Examples

Run this code
# 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