Skip to contents

Returns the CDF of a discrete distribution specified by its bin-wise discrete-time hazards. Converts hazards to a PMF via hazards_to_pmf() then delegates to pdiscretestep().

Usage

pdiscretehazard(q, boundaries = NULL, hazards)

Arguments

q

Numeric vector of quantiles.

boundaries

Numeric vector of length \(K+1\) defining the bin edges. Must be strictly increasing. Defaults to 0:K.

hazards

Numeric vector of length \(K\) (or \(K-1\), in which case a trailing 1 is appended) giving the discrete-time conditional hazard for each bin. Values must be in \([0, 1]\).

Value

Numeric vector of CDF values, the same length as q.

Details

Outside fitting it is a deterministic wrapper around pdiscretestep(). It earns its keep as a fitting parameterisation in fitdistdoublecens() because the random walk on the logit hazard smooths the recovered PMF.

Examples

hazards <- c(0.3, 0.5, 1)
pdiscretehazard(c(0.5, 1, 2, 3), boundaries = 0:3, hazards = hazards)
#> [1] 0.00 0.30 0.65 1.00