[Stable]

Exponential distributions are frequently used to model waiting times and the time between events in a Poisson process.

dist_exponential(rate)

Arguments

rate

vector of rates.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_exponential.html

In the following, let \(X\) be an Exponential random variable with parameter rate = \(\lambda\).

Support: \(x \in [0, \infty)\)

Mean: \(\frac{1}{\lambda}\)

Variance: \(\frac{1}{\lambda^2}\)

Probability density function (p.d.f):

$$ f(x) = \lambda e^{-\lambda x} $$

Cumulative distribution function (c.d.f):

$$ F(x) = 1 - e^{-\lambda x} $$

Moment generating function (m.g.f):

$$ E(e^{tX}) = \frac{\lambda}{\lambda - t}, \quad t < \lambda $$

Examples

dist <- dist_exponential(rate = c(2, 1, 2/3))

dist
#> <distribution[3]>
#> [1] Exp(2)    Exp(1)    Exp(0.67)
mean(dist)
#> [1] 0.5 1.0 1.5
variance(dist)
#> [1] 0.25 1.00 2.25
skewness(dist)
#> [1] 2 2 2
kurtosis(dist)
#> [1] 6 6 6

generate(dist, 10)
#> [[1]]
#>  [1] 1.19438496 0.58504573 0.69981352 0.23987251 0.16222741 0.03819245
#>  [7] 0.50848099 0.12868211 0.61835723 0.74538538
#> 
#> [[2]]
#>  [1] 0.818399419 0.413892996 1.162892001 2.173944251 0.169463063 0.005494154
#>  [7] 0.242938755 0.899124132 0.855740414 0.133994130
#> 
#> [[3]]
#>  [1] 1.73263985 1.05591869 0.13518904 1.67512983 0.12339740 0.07095131
#>  [7] 1.01118518 4.26707688 4.73864817 0.87630883
#> 

density(dist, 2)
#> [1] 0.03663128 0.13533528 0.17573143
density(dist, 2, log = TRUE)
#> [1] -3.306853 -2.000000 -1.738798

cdf(dist, 4)
#> [1] 0.9996645 0.9816844 0.9305165

quantile(dist, 0.7)
#> [1] 0.6019864 1.2039728 1.8059592