Laplace {L1pack}R Documentation

The symmetric 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, log = FALSE)
plaplace(q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
qlaplace(p, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
rlaplace(n, location = 0, scale = 1)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

location

location parameter μ\mu, which is the mean.

scale

scale parameter ϕ\phi. Scale must be positive.

log, log.p

logical; if TRUE, probabilities pp are given as log(p)\log(p).

lower.tail

logical; if TRUE (default), probabilities are P(Xx)P(X \le x), otherwise, P(X>x)P(X > x).

Details

If location or scale are not specified, they assume the default values of 0 and 1 respectively.

The Laplace distribution with location μ\mu and scale ϕ\phi has density

f(x)=12ϕexp(2xμ/ϕ), f(x) = \frac{1}{\sqrt{2}\phi} \exp(-\sqrt{2}|x-\mu|/\phi),

where <y<-\infty < y < \infty, <μ<-\infty < \mu < \infty and ϕ>0\phi > 0. The mean is μ\mu and the variance is ϕ2\phi^2.

The cumulative distribution function, assumes the form

F(x)={12exp(2(xμ)/ϕ)x<μ,112exp(2(xμ)/ϕ)xμ. F(x) = \left\{\begin{array}{ll} \frac{1}{2} \exp(\sqrt{2}(x - \mu)/\phi) & x < \mu, \\ 1 - \frac{1}{2} \exp(-\sqrt{2}(x - \mu)/\phi) & x \geq \mu. \end{array}\right.

The quantile function, is given by

F1(p)={μ+ϕ2log(2p)p<0.5,μϕ2log(2(1p))p0.5. F^{-1}(p) = \left\{\begin{array}{ll} \mu + \frac{\phi}{\sqrt{2}} \log(2p) & p < 0.5, \\ \mu - \frac{\phi}{\sqrt{2}} \log(2(1-p)) & p \geq 0.5. \end{array}\right.

Value

dlaplace, plaplace, and qlaplace are respectively the density, distribution function and quantile function of the Laplace distribution. rlaplace generates random deviates drawn from the Laplace distribution, the length of the result is determined by n.

Author(s)

Felipe Osorio and Tymoteusz Wolodzko

References

Kotz, S., Kozubowski, T.J., Podgorski, K. (2001). The Laplace Distributions and Generalizations. Birkhauser, Boston.

Krishnamoorthy, K. (2006). Handbook of Statistical Distributions with Applications, 2nd Ed. Chapman & Hall, Boca Raton.

See Also

Distributions for other standard distributions and rmLaplace for the random generation from the multivariate Laplace distribution.

Examples

x <- rlaplace(1000)
## QQ-plot for Laplace data against true theoretical distribution:
qqplot(qlaplace(ppoints(1000)), x, main = "Laplace QQ-plot",
  xlab = "Theoretical quantiles", ylab = "Sample quantiles")
abline(c(0,1), col = "red", lwd = 2)

[Package L1pack version 0.41-245 Index]