Learn R Programming

LaplacesDemon (version 16.1.6)

dist.Laplace: Laplace Distribution: Univariate Symmetric

Description

These functions provide the density, distribution function, quantile function, and random generation for the univariate, symmetric, Laplace distribution with location parameter \(\mu\) and scale parameter \(\lambda\).

Usage

dlaplace(x, location=0, scale=1, log=FALSE)
plaplace(q, location=0, scale=1)
qlaplace(p, location=0, scale=1)
rlaplace(n, location=0, scale=1)

Arguments

x, q

These are each a vector of quantiles.

p

This is a vector of probabilities.

n

This is the number of observations, which must be a positive integer that has length 1.

location

This is the location parameter \(\mu\).

scale

This is the scale parameter \(\lambda\), which must be positive.

log

Logical. If log=TRUE, then the logarithm of the density is returned.

Value

dlaplace gives the density, plaplace gives the distribution function, qlaplace gives the quantile function, and rlaplace generates random deviates.

Details

  • Application: Continuous Univariate

  • Density: \(p(\theta) = \frac{1}{2 \lambda} \exp(-\frac{|\theta - \mu|}{\lambda})\)

  • Inventor: Pierre-Simon Laplace (1774)

  • Notation 1: \(\theta \sim \mathrm{Laplace}(\mu,\lambda)\)

  • Notation 2: \(\theta \sim \mathcal{L}(\mu, \lambda)\)

  • Notation 3: \(p(\theta) = \mathrm{Laplace}(\theta | \mu, \lambda)\)

  • Notation 4: \(p(\theta) = \mathcal{L}(\theta | \mu, \lambda)\)

  • Parameter 1: location parameter \(\mu\)

  • Parameter 2: scale parameter \(\lambda > 0\)

  • Mean: \(E(\theta) = \mu\)

  • Variance: \(var(\theta) = 2 \lambda^2\)

  • Mode: \(mode(\theta) = \mu\)

The Laplace distribution (Laplace, 1774) is also called the double exponential distribution, because it looks like two exponential distributions back to back with respect to location \(\mu\). It is also called the ``First Law of Laplace'', just as the normal distribution is referred to as the ``Second Law of Laplace''. The Laplace distribution is symmetric with respect to \(\mu\), though there are asymmetric versions of the Laplace distribution. The PDF of the Laplace distribution is 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, \(\mu\). Consequently, the Laplace distribution has fatter tails than the normal distribution. It has been argued that the Laplace distribution fits most things in nature better than the normal distribution.

There are many extensions to the Laplace distribution, such as the asymmetric Laplace, asymmetric log-Laplace, Laplace (re-parameterized for precision), log-Laplace, multivariate Laplace, and skew-Laplace, among many more.

These functions are similar to those in the VGAM package.

References

Laplace, P. (1774). "Memoire sur la Probabilite des Causes par les Evenements." l'Academie Royale des Sciences, 6, 621--656. English translation by S.M. Stigler in 1986 as "Memoir on the Probability of the Causes of Events" in Statistical Science, 1(3), p. 359--378.

See Also

dalaplace, dallaplace, dexp, dlaplacep, dllaplace, dmvl, dnorm, dnormp, dnormv, dsdlaplace, and dslaplace.

Examples

Run this code
# NOT RUN {
library(LaplacesDemon)
x <- dlaplace(1,0,1)
x <- plaplace(1,0,1)
x <- qlaplace(0.5,0,1)
x <- rlaplace(100,0,1)

#Plot Probability Functions
x <- seq(from=-5, to=5, by=0.1)
plot(x, dlaplace(x,0,0.5), ylim=c(0,1), type="l", main="Probability Function",
     ylab="density", col="red")
lines(x, dlaplace(x,0,1), type="l", col="green")
lines(x, dlaplace(x,0,2), type="l", col="blue")
legend(2, 0.9, expression(paste(mu==0, ", ", lambda==0.5),
     paste(mu==0, ", ", lambda==1), paste(mu==0, ", ", lambda==2)),
     lty=c(1,1,1), col=c("red","green","blue"))
# }

Run the code above in your browser using DataLab