Skip to contents

Functions to compute the probability density function, cumulative distribution function, and quantile function for the Hyperexponential distribution.

Usage

hyperexponential_pdf(x, probabilities, rates)

hyperexponential_lpdf(x, probabilities, rates)

hyperexponential_cdf(x, probabilities, rates)

hyperexponential_lcdf(x, probabilities, rates)

hyperexponential_quantile(p, probabilities, rates)

Arguments

x

quantile

probabilities

vector of probabilities (sum must be 1)

rates

vector of rates (all rates must be > 0)

p

probability (0 <= p <= 1)

Value

A single numeric value with the computed probability density, log-probability density, cumulative distribution, log-cumulative distribution, or quantile depending on the function called.

See also

Boost Documentation for more details on the mathematical background.

Examples

# Hyperexponential distribution with probabilities = c(0.5, 0.5) and rates = c(1, 2)
hyperexponential_pdf(2, c(0.5, 0.5), c(1, 2))
#> [1] 0.08598328
hyperexponential_lpdf(2, c(0.5, 0.5), c(1, 2))
#> [1] -2.453602
hyperexponential_cdf(2, c(0.5, 0.5), c(1, 2))
#> [1] 0.9231745
hyperexponential_lcdf(2, c(0.5, 0.5), c(1, 2))
#> [1] -0.07993696
hyperexponential_quantile(0.5, c(0.5, 0.5), c(1, 2))
#> [1] 0.4812118