Convert Instantaneous Hazard Rates to Survival Curve
Source:R/adjust_survival_curve.R
convert_hazard_to_survival.Rd
This function converts a vector of hazard rates into a survival curve. The survival probability at each time point is calculated based on the cumulative sum of the hazard rates up to that point.
Details
The relationship between the hazard rates and the survival probabilities is given by: $$S(t) = \exp(-\sum_{i=1}^{t} h_i)$$ where \(S(t)\) is the survival probability at time \(t\), and \(h_i\) is the hazard rate at time \(i\).
Examples
if (FALSE) { # \dontrun{
# Example hazard rates
hazard_rates <- c(0.01, 0.02, 0.015, 0.03)
# Convert hazard rates to survival probabilities
survival_curve <- convert_hazard_to_survival(hazard_rates)
survival_curve
} # }