Search This Blog

Sunday, January 22, 2012

The Laplace Distribution


laplaceUC {VGAM}R Documentation

The Laplace Distribution

Description

Density, distribution function, quantile function and random generation for the Laplace distribution with location parameter location and scale parameter scale.

Usage

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

Arguments

x, q vector of quantiles.
p vector of probabilities.
n number of observations. Positive integer of length 1.
location the location parameter a, which is the mean.
scale the scale parameter b. Must consist of positive values.

Details

The Laplace distribution is often known as the double-exponential distribution and, for modelling, has heavier tail than the normal distribution. The Laplace density function is
f(y) = (1/(2b)) exp( -|y-a|/b )
where -Inf, -Inf and b>0. The mean is a and the variance is 2b^2.
See laplace, the VGAM family function for estimating the two parameters by maximum likelihood estimation, for formulae and details. Apart from n, all the above arguments may be vectors and are recyled to the appropriate length if necessary.

Value

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

Author(s)

T. W. Yee

References

Evans, M., Hastings, N. and Peacock, B. (2000) Statistical Distributions, New York: Wiley-Interscience, Third edition.

See Also

laplace.

Examples

loc = 1; b = 2
y = rlaplace(n=100, loc=loc, scale=b)
mean(y)
loc      # population mean
var(y)
2 * b^2  # population variance

## Not run: 
x = seq(-5, 5, by=0.01)
loc = 0; b = 1.5
plot(x, dlaplace(x, loc, b), type="l", col="blue", ylim=c(0,1),
     main="Blue is density, red is cumulative distribution function",
     sub="Purple are 5,10,...,95 percentiles", las=1, ylab="")
abline(h=0, col="blue", lty=2)
lines(qlaplace(seq(0.05,0.95,by=0.05), loc, b),
      dlaplace(qlaplace(seq(0.05,0.95,by=0.05), loc, b), loc, b),
      col="purple", lty=3, type="h")
lines(x, plaplace(x, loc, b), type="l", col="red")
abline(h=0, lty=2)
## End(Not run)

plaplace(qlaplace(seq(0.05,0.95,by=0.05), loc, b), loc, b)

[Package VGAM version 0.7-4 Index]