RateToProb: Convert a rate to a probability

Description Usage Arguments Value Examples

View source: R/transition.R

Description

Converts a vector of rates to a vector of probabilities.

Usage

1
RateToProb(r, t = 1)

Arguments

r

A vector of rates.

t

The time frame of the desired probability in the units of the input rate.

Value

A vector of probabilities in the unit of time t. If any rates are less than 0, the function returns NULL.

Examples

1
2
3
# If event rate over over 2 years is 50%
RateToProb(0.5, 1/2) # returns an annual probability of 0.22
RateToProb(0.5, 1/24) # returns a monthly probability of 0.02

austinnam/modeltools documentation built on Aug. 3, 2019, 7:20 p.m.