[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.745385384 0.409199710 0.206946498 0.581446001 1.086972126 0.084731532
#>  [7] 0.002747077 0.121469377 0.449562066 0.427870207
#> 
#> [[2]]
#>  [1] 0.13399413 1.15509323 0.70394579 0.09012603 1.11675322 0.08226493
#>  [7] 0.04730087 0.67412345 2.84471792 3.15909878
#> 
#> [[3]]
#>  [1] 0.87630883 3.01182912 3.27025307 0.08015193 0.25208480 0.38147360
#>  [7] 2.60041678 1.16269560 1.74450711 0.27038865
#> 

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