Learn R Programming

HQM (version 0.1.1)

make_sf: Survival function from a hazard

Description

Creates a survival function from a hazard rate which was calculated on a grid.

Usage

make_sf(step_size_s_grid, haz)

Value

A vector of values \(S(t_i)\).

Arguments

step_size_s_grid

Numeric value indicating the distance between two grid continuous grid points.

haz

Vector of hazard values. Hazard rate must have been calculated on a time grid.

Details

The function make_sf calculates the survival function $$S(t) = \exp (-\int_0^t h(t) dt),$$ where \(h\) is the hazard rate. Here, a discritisation via an equidistant grid \(\{ t_i \}\) on \([0,t]\) is used to calculate the integral and it is assumed that \(h\) has been calculated for exactly these time points \( t_i \).

Examples

Run this code
make_sf(0.1, rep(0.1,10))

Run the code above in your browser using DataLab