Laplace distribution#Random variate generation

{{Short description|Probability distribution}}

{{Probability distribution

|name =Laplace

|type =density

|pdf_image =Image:Laplace pdf mod.svg

|cdf_image =Image:Laplace cdf mod.svg

|parameters =\mu location (real)
b > 0 scale (real)

|support =\mathbb{R}

|pdf =\frac{1}{2b} \exp \left(-\frac

x-\mu
b \right)

|cdf =\begin{cases}

\frac{1}{2} \exp \left( \frac{x-\mu}{b} \right) & \text{if }x \leq \mu \\[8pt]

1-\frac{1}{2} \exp \left( -\frac{x-\mu}{b} \right) & \text{if }x \geq \mu

\end{cases}

|quantile =\begin{cases}

\mu+b \ln \left( 2F\right) & \text{if }F \leq \frac{1}{2} \\[8pt]

\mu-b\ln \left( 2-2F\right) & \text{if }F \geq \frac{1}{2}

\end{cases}

|mean =\mu

|median =\mu

|mode =\mu

|variance =2b^2

|mad =b \ln 2

|skewness =0

|kurtosis =3

|entropy =\log(2be)

|mgf =\frac{\exp(\mu t)}{1-b^2 t^2} \text{ for }|t| < 1/b

|char =\frac{\exp(\mu it)}{1+b^2 t^2}

|ES = \begin{cases}

\mu +b \left(\frac{p}{1-p} \right)(1 - \ln (2p)) &, p < .5 \\

\mu + b\left(1 - \ln \left(2(1-p)\right) \right) &, p \geq .5

\end{cases}{{cite journal |last1=Norton |first1=Matthew |last2=Khokhlov |first2=Valentyn |last3=Uryasev |first3=Stan |year=2019 |title=Calculating CVaR and bPOE for common probability distributions with application to portfolio optimization and density estimation |journal=Annals of Operations Research |volume=299 |issue=1–2 |pages=1281–1315 |publisher=Springer|doi=10.1007/s10479-019-03373-1 |arxiv=1811.11301 |url=http://uryasev.ams.stonybrook.edu/wp-content/uploads/2019/10/Norton2019_CVaR_bPOE.pdf |access-date=2023-02-27}}

|bPOE =\begin{cases}

\frac{1}{2}e^{1-\left(\frac{x-\mu}{b} \right)}&, x \geq \mu +b \\

1 - \frac{z}{\mathcal{W}( -2e^{-z-1}z)} &, x < \mu + b

\end{cases}

Where z=\frac{x-\mu}{b}, and \mathcal{W} is the Lambert-W function

}}

In probability theory and statistics, the Laplace distribution is a continuous probability distribution named after Pierre-Simon Laplace. It is also sometimes called the double exponential distribution, because it can be thought of as two exponential distributions (with an additional location parameter) spliced together along the x-axis,{{Citation |last=Chattamvelli |first=Rajan |title=Laplace Distribution |date=2021 |work=Continuous Distributions in Engineering and the Applied Sciences – Part II |pages=189–199 |url=https://link.springer.com/10.1007/978-3-031-02435-1_4 |access-date=2025-04-04 |place=Cham |publisher=Springer International Publishing |language=en |doi=10.1007/978-3-031-02435-1_4 |isbn=978-3-031-01307-2 |last2=Shanmugam |first2=Ramalingam}} although the term is also sometimes used to refer to the Gumbel distribution. The difference between two independent identically distributed exponential random variables is governed by a Laplace distribution, as is a Brownian motion evaluated at an exponentially distributed random time{{Citation needed|reason=Brownian motion is not mentioned elsewhere in this article. Either this topic should be expanded upon in the article, or there should be a citation justifying the claim.|date=October 2023}}. Increments of Laplace motion or a variance gamma process evaluated over the time scale also have a Laplace distribution.

Definitions

=Probability density function=

A random variable has a \operatorname{Laplace}(\mu, b) distribution if its probability density function is

: f(x \mid \mu, b) = \frac{1}{2b} \exp\left( -\frac

x - \mu
{b} \right),

where \mu is a location parameter, and b > 0, which is sometimes referred to as the "diversity", is a scale parameter. If \mu = 0 and b = 1, the positive half-line is exactly an exponential distribution scaled by 1/2.{{cite journal | last1 = Huang | first1 = Yunfei. | display-authors = etal | year = 2022 | title = Sparse inference and active learning of stochastic differential equations from data | journal = Scientific Reports | volume = 12 | number = 1| page = 21691 | doi = 10.1038/s41598-022-25638-9 | pmid = 36522347 | doi-access = free| pmc = 9755218 | arxiv = 2203.11010 | bibcode = 2022NatSR..1221691H }}

The probability density function of the Laplace distribution is also reminiscent of the normal distribution; however, whereas the normal distribution is expressed in terms of the squared difference from the mean \mu, the Laplace density is expressed in terms of the absolute difference from the mean. Consequently, the Laplace distribution has fatter tails than the normal distribution. It is a special case of the generalized normal distribution and the hyperbolic distribution. Continuous symmetric distributions that have exponential tails, like the Laplace distribution, but which have probability density functions that are differentiable at the mode include the logistic distribution, hyperbolic secant distribution, and the Champernowne distribution.

=Cumulative distribution function=

The Laplace distribution is easy to integrate (if one distinguishes two symmetric cases) due to the use of the absolute value function. Its cumulative distribution function is as follows:

:\begin{align}

F(x) &= \int_{-\infty}^x \!\!f(u)\,\mathrm{d}u = \begin{cases}

\frac12 \exp \left( \frac{x-\mu}{b} \right) & \mbox{if }x < \mu \\

1-\frac12 \exp \left( -\frac{x-\mu}{b} \right) & \mbox{if }x \geq \mu

\end{cases} \\

&=\tfrac{1}{2} + \tfrac{1}{2} \sgn(x-\mu) \left(1-\exp \left(-\frac

x-\mu
{b} \right ) \right ).

\end{align}

The inverse cumulative distribution function is given by

:F^{-1}(p) = \mu - b\,\sgn(p-0.5)\,\ln(1 - 2|p-0.5|).

Properties

=Moments=

:\mu_r' = \bigg({\frac{1}{2}}\bigg) \sum_{k=0}^r \bigg[{\frac{r!}{(r-k)!}} b^k \mu^{(r-k)} \{1 + (-1)^k\}\bigg].

=Related distributions=

  • If X \sim \textrm{Laplace}(\mu, b) then kX + c \sim \textrm{Laplace}(k\mu + c, |k|b).
  • If X \sim \textrm{Laplace}(0, 1) then bX \sim \textrm{Laplace}(0, b).
  • If X \sim \textrm{Laplace}(0, b) then \left|X\right| \sim \textrm{Exponential}\left(b^{-1}\right) (exponential distribution).
  • If X, Y \sim \textrm{Exponential}(\lambda) then X - Y \sim \textrm{Laplace}\left(0, \lambda^{-1}\right)
  • If X \sim \textrm{Laplace}(\mu, b) then \left|X - \mu\right| \sim \textrm{Exponential}(b^{-1}).
  • If X \sim \textrm{Laplace}(\mu, b) then X \sim \textrm{EPD}(\mu, b, 1) (exponential power distribution).
  • If X_1, ...,X_4 \sim \textrm{N}(0, 1) (normal distribution) then X_1X_2 - X_3X_4 \sim \textrm{Laplace}(0, 1) and (X_1^2 - X_2^2 + X_3^2 - X_4^2)/2 \sim \textrm{Laplace}(0, 1).
  • If X_i \sim \textrm{Laplace}(\mu, b) then \frac{\displaystyle 2}{b} \sum_{i=1}^n |X_i-\mu| \sim \chi^2(2n) (chi-squared distribution).
  • If X, Y \sim \textrm{Laplace}(\mu, b) then \tfrac
    X-\mu
    Y-\mu
    \sim \operatorname{F}(2,2). (F-distribution)
  • If X, Y \sim \textrm{U}(0, 1) (uniform distribution) then \log(X/Y) \sim \textrm{Laplace}(0, 1).
  • If X \sim \textrm{Exponential}(\lambda) and Y \sim \textrm{Bernoulli}(0.5) (Bernoulli distribution) independent of X, then X(2Y - 1) \sim \textrm{Laplace}\left(0, \lambda^{-1}\right).
  • If X \sim \textrm{Exponential}(\lambda) and Y \sim \textrm{Exponential}(\nu) independent of X, then \lambda X - \nu Y \sim \textrm{Laplace}(0, 1)
  • If X has a Rademacher distribution and Y \sim \textrm{Exponential}(\lambda) then XY \sim \textrm{Laplace}(0, 1/\lambda).
  • If V \sim \textrm{Exponential}(1) and Z \sim N(0, 1) independent of V, then X = \mu + b \sqrt{2 V}Z \sim \mathrm{Laplace}(\mu,b).
  • If X \sim \textrm{GeometricStable}(2, 0, \lambda, 0) (geometric stable distribution) then X \sim \textrm{Laplace}(0, \lambda).
  • The Laplace distribution is a limiting case of the hyperbolic distribution.
  • If X|Y \sim \textrm{N}(\mu,Y^2) with Y \sim \textrm{Rayleigh}(b) (Rayleigh distribution) then X \sim \textrm{Laplace}(\mu, b). Note that if Y \sim \textrm{Rayleigh}(b), then Y^2 \sim \textrm{Gamma}(1,2b^2) with \textrm{E}(Y^2)=2b^2, which in turn equals the exponential distribution \textrm{Exp}(1/(2b^2)).
  • Given an integer n \ge 1, if X_i, Y_i \sim \Gamma\left(\frac{1}{n}, b\right) (gamma distribution, using k, \theta characterization), then \sum_{i=1}^n \left( \frac{\mu}{n} + X_i - Y_i\right) \sim \textrm{Laplace}(\mu, b) (infinite divisibility){{cite book |title=The Laplace distribution and generalizations: a revisit with applications to Communications, Economics, Engineering and Finance |first1= Samuel|last1= Kotz |first2=Tomasz J. |last2=Kozubowski |first3=Krzysztof |last3= Podgórski |pages=23 (Proposition 2.2.2, Equation 2.2.8) |url=https://books.google.com/books?id=cb8B07hwULUC&q=laplace+distribution+exponential+characteristic+function&pg=PA23|isbn= 9780817641665 |publisher=Birkhauser|year=2001}}
  • If X has a Laplace distribution, then Y = eX has a log-Laplace distribution; conversely, if X has a log-Laplace distribution, then its logarithm has a Laplace distribution.

=Probability of a Laplace being greater than another =

Let X, Y be independent laplace random variables: X \sim \textrm{Laplace}(\mu_X, b_X) and Y \sim \textrm{Laplace}(\mu_Y, b_Y), and we want to compute P(X>Y).

The probability of P(X > Y) can be reduced (using the properties below) to P(\mu + bZ_1 > Z_2), where Z_1, Z_2 \sim \textrm{Laplace}(0, 1). This probability is equal to

P(\mu + bZ_1 > Z_2) = \begin{cases}

\frac{b^2 e^{\mu/b} - e^\mu}{2(b^2 -1)}, & \text{when } \mu < 0 \\

1-\frac{ b^2 e^{-\mu/b} - e^{-\mu}}{2(b^2 -1)}, & \text{when } \mu > 0 \\

\end{cases}

When b = 1 , both expressions are replaced by their limit as b \to 1:

P(\mu + Z_1 > Z_2) = \begin{cases}

e^\mu\frac{(2-\mu)}4, & \text{when } \mu < 0 \\

1-e^{-\mu}\frac{(2+\mu)}4, & \text{when } \mu > 0 \\

\end{cases}

To compute the case for \mu > 0 , note that P(\mu + Z_1 > Z_2) = 1 - P(\mu + Z_1 < Z_2) = 1 - P(-\mu - Z_1 > -Z_2) = 1 - P(-\mu + Z_1 > Z_2)

since Z \sim -Z when Z \sim \textrm{Laplace}(0, 1) .

=Relation to the exponential distribution=

A Laplace random variable can be represented as the difference of two independent and identically distributed (iid) exponential random variables. One way to show this is by using the characteristic function approach. For any set of independent continuous random variables, for any linear combination of those variables, its characteristic function (which uniquely determines the distribution) can be acquired by multiplying the corresponding characteristic functions.

Consider two i.i.d random variables X, Y \sim \textrm{Exponential}(\lambda). The characteristic functions for X, -Y are

:\frac{\lambda }{-i t+\lambda }, \quad \frac{\lambda }{i t+\lambda }

respectively. On multiplying these characteristic functions (equivalent to the characteristic function of the sum of the random variables X + (-Y)), the result is

:\frac{\lambda ^2}{(-i t+\lambda ) (i t+\lambda )} = \frac{\lambda ^2}{t^2+\lambda ^2}.

This is the same as the characteristic function for Z \sim \textrm{Laplace}(0,1/\lambda), which is

:\frac{1}{1+\frac{t^2}{\lambda ^2}}.

=Sargan distributions=

Sargan distributions are a system of distributions of which the Laplace distribution is a core member. A pth order Sargan distribution has densityEveritt, B.S. (2002) The Cambridge Dictionary of Statistics, CUP. {{isbn|0-521-81099-X}}Johnson, N.L., Kotz S., Balakrishnan, N. (1994) Continuous Univariate Distributions, Wiley. {{isbn|0-471-58495-9}}. p. 60

:f_p(x)=\tfrac{1}{2} \exp(-\alpha |x|) \frac{\displaystyle 1+\sum_{j=1}^p \beta_j \alpha^j |x|^j}{\displaystyle 1+\sum_{j=1}^p j!\beta_j},

for parameters \alpha \ge 0, \beta_j \ge 0. The Laplace distribution results for p = 0.

Statistical inference

Given n independent and identically distributed samples x_1, x_2, ..., x_n, the maximum likelihood (MLE) estimator of \mu is the sample median,{{Cite journal

| author = Robert M. Norton

| author-link = Robert M. Norton

| title = The Double Exponential Distribution: Using Calculus to Find a Maximum Likelihood Estimator

| journal = The American Statistician

| volume = 38

| issue = 2

|date=May 1984

| pages = 135–136

| doi = 10.2307/2683252

| jstor = 2683252

| publisher = American Statistical Association

}}

:\hat{\mu} = \mathrm{med}(x).

The MLE estimator of b is the mean absolute deviation from the median,{{citation needed|date=August 2022}}

:\hat{b} = \frac{1}{n} \sum_{i = 1}^{n} |x_i - \hat{\mu}|.

revealing a link between the Laplace distribution and least absolute deviations.

A correction for small samples can be applied as follows:

:\hat{b}^* = \hat{b} \cdot n/(n-2)

(see: exponential distribution#Parameter estimation).

Occurrence and applications

The Laplacian distribution has been used in speech recognition to model priors on DFT coefficients {{Cite journal

| last1 = Eltoft

| first1 = T.

| last2 = Taesu Kim

| last3 = Te-Won Lee

| doi = 10.1109/LSP.2006.870353

| title = On the multivariate Laplace distribution

| journal = IEEE Signal Processing Letters

| url = http://eo.uit.no/publications/TE-SPL-06.pdf

| volume = 13

| issue = 5

| pages = 300–303

| year = 2006

| bibcode = 2006ISPL...13..300E

| s2cid = 1011487

| access-date = 2012-07-04

| archive-url = https://web.archive.org/web/20130606114728/http://eo.uit.no/publications/TE-SPL-06.pdf

| archive-date = 2013-06-06

| url-status = dead

}} and in JPEG image compression to model AC coefficients {{Cite journal

| last1 = Minguillon | first1 = J.

| last2 = Pujol | first2 = J.

| doi = 10.1117/1.1344592

| title = JPEG standard uniform quantization error modeling with applications to sequential and progressive operation modes

| journal = Journal of Electronic Imaging

| volume = 10

| issue = 2

| pages = 475–485

| year = 2001 | bibcode = 2001JEI....10..475M

| hdl = 10609/6263

| url = http://openaccess.uoc.edu/webapps/o2/bitstream/10609/6263/6/jei-jpeg.pdf| hdl-access = free

}} generated by a DCT.

  • The addition of noise drawn from a Laplacian distribution, with scaling parameter appropriate to a function's sensitivity, to the output of a statistical database query is the most common means to provide differential privacy in statistical databases.

File:Laplace Surinam.png

  • In regression analysis, the least absolute deviations estimate arises as the maximum likelihood estimate if the errors have a Laplace distribution.
  • The Lasso can be thought of as a Bayesian regression with a Laplacian prior for the coefficients.{{cite book |first=Scott |last=Pardo |title=Statistical Analysis of Empirical Data Methods for Applied Sciences |publisher=Springer |year=2020 |isbn=978-3-030-43327-7 |page=58 |url=https://books.google.com/books?id=k0nhDwAAQBAJ&pg=PA58 }}
  • In hydrology the Laplace distribution is applied to extreme events such as annual maximum one-day rainfalls and river discharges. The blue picture, made with CumFreq, illustrates an example of fitting the Laplace distribution to ranked annually maximum one-day rainfalls showing also the 90% confidence belt based on the binomial distribution. The rainfall data are represented by plotting positions as part of the cumulative frequency analysis.
  • The Laplace distribution has applications in finance. For example, S.G. Kou developed a model for financial instrument prices incorporating a Laplace distribution (in some cases an asymmetric Laplace distribution) to address problems of skewness, kurtosis and the volatility smile that often occur when using a normal distribution for pricing these instruments.{{cite journal|title=A Jump-Diffusion Model for Option Pricing|author=Kou, S.G.|url=https://www.jstor.org/stable/822677|date=August 8, 2002|accessdate=2022-03-01|journal=Management Science|volume=48|issue=8|pages=1086–1101|doi=10.1287/mnsc.48.8.1086.166 |jstor=822677 }}{{cite book|title=General Equilibrium Option Pricing Method: Theoretical and Empirical Study|page=70|author=Chen, Jian|year=2018|publisher=Springer|isbn=9789811074288}}

: The Laplace distribution, being a composite or double distribution, is applicable in situations where the lower values originate under different external conditions than the higher ones so that they follow a different pattern.[https://www.waterlog.info/composite.htm A collection of composite distributions]

Random variate generation

{{further|Non-uniform random variate generation}}

Given a random variable U drawn from the uniform distribution in the interval \left(-1/2, 1/2\right), the random variable

:X=\mu - b\,\sgn(U)\,\ln(1 - 2|U|)

has a Laplace distribution with parameters \mu and b. This follows from the inverse cumulative distribution function given above.

A \textrm{Laplace}(0, b) variate can also be generated as the difference of two i.i.d. \textrm{Exponential}(1/b) random variables. Equivalently, \textrm{Laplace}(0,1) can also be generated as the logarithm of the ratio of two i.i.d. uniform random variables.

History

This distribution is often referred to as "Laplace's first law of errors". He published it in 1774, modeling the frequency of an error as an exponential function of its magnitude once its sign was disregarded. Laplace would later replace this model with his "second law of errors", based on the normal distribution, after the discovery of the central limit theorem.Laplace, P-S. (1774). Mémoire sur la probabilité des causes par les évènements. Mémoires de l’Academie Royale des Sciences Presentés par Divers Savan, 6, 621–656{{cite journal | last=Wilson | first=Edwin Bidwell | title=First and Second Laws of Error | journal=Journal of the American Statistical Association | publisher=Informa UK Limited | volume=18 | issue=143 | year=1923 | issn=0162-1459 | doi=10.1080/01621459.1923.10502116 | pages=841–851}} {{PD-notice}}

Keynes published a paper in 1911 based on his earlier thesis wherein he showed that the Laplace distribution minimised the absolute deviation from the median.{{cite journal | last=Keynes | first=J. M. | title=The Principal Averages and the Laws of Error which Lead to Them | journal=Journal of the Royal Statistical Society | publisher=JSTOR | volume=74 | issue=3 | year=1911 | pages=322–331 | issn=0952-8385 | doi=10.2307/2340444 | jstor=2340444 | url=https://zenodo.org/record/2253549 }}

See also

References

{{Reflist|30em}}