Learn R Programming

distributional (version 0.6.0)

dist_laplace: The Laplace distribution

Description

[Stable]

The Laplace distribution, also known as the double exponential distribution, is a continuous probability distribution that is symmetric around its location parameter.

Usage

dist_laplace(mu, sigma)

Arguments

mu

The location parameter (mean) of the Laplace distribution.

sigma

The positive scale parameter of the Laplace distribution.

Details

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

In the following, let \(X\) be a Laplace random variable with location parameter mu = \(\mu\) and scale parameter sigma = \(\sigma\).

Support: \(R\), the set of all real numbers

Mean: \(\mu\)

Variance: \(2\sigma^2\)

Probability density function (p.d.f):

$$ f(x) = \frac{1}{2\sigma} \exp\left(-\frac{|x - \mu|}{\sigma}\right) $$

Cumulative distribution function (c.d.f):

$$ F(x) = \begin{cases} \frac{1}{2} \exp\left(\frac{x - \mu}{\sigma}\right) & \text{if } x < \mu \\ 1 - \frac{1}{2} \exp\left(-\frac{x - \mu}{\sigma}\right) & \text{if } x \geq \mu \end{cases} $$

Moment generating function (m.g.f):

$$ E(e^{tX}) = \frac{\exp(\mu t)}{1 - \sigma^2 t^2} \text{ for } |t| < \frac{1}{\sigma} $$

See Also

extraDistr::Laplace

Examples

Run this code
dist <- dist_laplace(mu = c(0, 2, -1), sigma = c(1, 2, 0.5))

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 0)
density(dist, 0, log = TRUE)

cdf(dist, 1)

quantile(dist, 0.7)

Run the code above in your browser using DataLab