Learn R Programming

discSurv (version 1.1.2)

estSurv: Estimated Survival Function

Description

Estimates the survival function S(T=t|x) based on estimated hazard rates. The hazard rates may or may not depend on covariates. The covariates have to be equal across all estimated hazard rates. Therefore the given hazard rates should only vary over time.

Usage

estSurv(haz)

Arguments

haz
Numeric vector of estimated hazard rates.

Value

  • Named vector of estimated probabilities of survival.

Details

The argument *haz* must be given for the first q intervals [a_0, a_1), [a_1, a_2), ..., [a_{q-1}, a_q). The last interval is calculated automatically.

See Also

estMargProb

Examples

Run this code
# Example unemployment data
library(Ecdat)
data(UnempDur)

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

# Convert to long format
UnempLong <- dataLong (dataSet=subUnempDur, timeColumn="spell", censColumn="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
hazard <- predict(Fit, newdata=subset(UnempLong, obj==1), type="response")
SurvivalFuncCondX <- estSurv(hazard)
SurvivalFuncCondX

Run the code above in your browser using DataLab