haz.to.prob: convert from hazards to probs

Description Usage Arguments Value

View source: R/library.R

Description

this function takes a hazard function and an age range and returns an approximation of the probability of death implied by the hazard over that age range. it does this either through approximations or through numerical integration. TODO - add more details here NB: this function expects ages to be the starting age (no need to add 0.5 or anything) TODO - document warning for integration try-error TODO - tests here - not too hard to think of...

Usage

1
haz.to.prob(haz.fn, theta, ages, nozero = TRUE, approx = FALSE)

Arguments

haz.fn

the hazard function

theta

parameter values for the hazard function

ages

a vector of ages with entries (z1,z2,...,zk). we'll return probabilities of survival for (z1,z2), (z2,z3), ..., (z(k-1),zk)

nozero

if TRUE, replace values that would be returned as zero with very small numbers instead. (this prevents errors when taking logs.)

approx

if TRUE, use analytical approximation; if FALSE, use numerical integration

Value

a vector of probabilities


dfeehan/mortfit documentation built on Nov. 14, 2020, 9:04 p.m.