Exponential distributions are frequently used to model waiting times and the time between events in a Poisson process.
dist_exponential(rate)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 $$
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.75475387 0.57160620 0.62948007 0.04829826 0.38481100 0.03384270
#> [7] 0.23925079 0.21952279 0.37553744 0.17385637
#>
#> [[2]]
#> [1] 2.0632670 0.3808103 1.9443705 0.5643083 4.2174098 2.8622615 0.9369852
#> [8] 0.5694194 0.8147494 1.7085647
#>
#> [[3]]
#> [1] 1.7535036 0.8319185 3.8079857 0.7278717 1.9197646 1.3158901 0.7287720
#> [8] 1.0627163 0.9450696 1.3627213
#>
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