dist.Laplace: Laplace Distribution: Univariate Symmetric

Description Usage Arguments Details Value References See Also Examples

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 λ.

Usage

1
2
3
4
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.

Details

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.

Value

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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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"))

LaplacesDemon documentation built on July 9, 2021, 5:07 p.m.