Skip to contents

Inverts hazards_to_pmf(): given a PMF, computes the discrete-time conditional hazard at each time point. $$h_i = pmf_i / (1 - \sum_{j < i} pmf_j)$$

Usage

pmf_to_hazards(pmf)

Arguments

pmf

Numeric vector of probabilities. Must be non-negative and sum to approximately 1.

Value

Numeric vector of hazards in \([0, 1]\).

Details

The returned vector has the same length as pmf, with the last entry equal to 1.

Examples

pmf_to_hazards(c(0.2, 0.3, 0.5))
#> [1] 0.200 0.375 1.000