Laplace | R Documentation |
Density, distribution function, quantile function and random generation for the
Laplace distribution with location parameter location
and scale parameter
scale
.
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)
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. |
location |
location parameter |
scale |
scale parameter |
log , log.p |
logical; if TRUE, probabilities |
lower.tail |
logical; if TRUE (default), probabilities are |
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) =
\frac{1}{\sqrt{2}\phi} \exp(-\sqrt{2}|x-\mu|/\phi),
where -\infty < y < \infty
, -\infty < \mu < \infty
and \phi > 0
.
The mean is \mu
and the variance is \phi^2
.
The cumulative distribution function, assumes the form
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
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.
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
.
Felipe Osorio and Tymoteusz Wolodzko
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.
Distributions for other standard distributions and rmLaplace
for the random generation from the multivariate Laplace distribution.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.