[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] 0.30969620 0.05938324 0.23372969 0.54596454 0.12506929 0.76738408
#>  [7] 0.18079862 0.29064701 0.89368535 0.53543165
#> 
#> [[2]]
#>  [1] 0.52171646 0.46220729 0.07835856 0.03886687 0.87164723 0.22059924
#>  [7] 2.50370500 2.87432418 0.33178157 0.30593455
#> 
#> [[3]]
#>  [1] 1.5770527 0.4144533 1.1909038 0.2363445 3.3091732 0.7269785 0.1476621
#>  [8] 0.4036328 2.2189845 0.5497100
#> 

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