Skip to contents

Returns \(h_j = p_j / (1 - \sum_{l < j} p_l)\), the conditional probability of stopping at index j given survival past j - 1. When the remaining mass has underflowed (below 1e-300) the hazard is set to 1 rather than dividing by zero.

Usage

morie_gh_discrete_hazard(p)

Arguments

p

numeric vector of probabilities over an ordered discrete support

Value

numeric vector of the same length as p holding the discrete hazards

References

Ghosal, S. and van der Vaart, A. (2017). Fundamentals of Nonparametric Bayesian Inference. Cambridge University Press.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_gh_discrete_hazard(V)
#> [1] 1 1 1 1 1 1 1 1