dalaplace | R Documentation |
Density, cumulative distribution, quantile functions and random number generation for the Asymmetric Laplace distribution with the location parameter mu, scale and the asymmetry parameter alpha.
dalaplace(q, mu = 0, scale = 1, alpha = 0.5, log = FALSE)
palaplace(q, mu = 0, scale = 1, alpha = 0.5)
qalaplace(p, mu = 0, scale = 1, alpha = 0.5)
ralaplace(n = 1, mu = 0, scale = 1, alpha = 0.5)
q |
vector of quantiles. |
mu |
vector of location parameters (means). |
scale |
vector of scale parameters. |
alpha |
value of asymmetry parameter. Varies from 0 to 1. |
log |
if |
p |
vector of probabilities. |
n |
number of observations. Should be a single number. |
When mu=0 and scale=1, the Laplace distribution becomes standardized. The distribution has the following density function:
f(x) = alpha (1-alpha) / scale exp(-(x-mu)/scale (alpha - I(x<=mu))),
where I(.) is the indicator function (equal to 1 if the condition is satisfied and zero otherwise).
When alpha=0.5, then the distribution becomes Symmetric Laplace, where scale = 1/2 MAE.
This distribution function aligns with the quantile estimates of parameters (Geraci & Bottai, 2007).
Finally, both palaplace
and qalaplace
are returned for
the lower tail of the distribution.
Depending on the function, various things are returned (usually either vector or scalar):
dalaplace
returns the density function value for the
provided parameters.
palaplace
returns the value of the cumulative function
for the provided parameters.
qalaplace
returns quantiles of the distribution. Depending
on what was provided in p
, mu
and scale
, this
can be either a vector or a matrix, or an array.
ralaplace
returns a vector of random variables
generated from the Laplace distribution. Depending on what was
provided in mu
and scale
, this can be either a vector
or a matrix or an array.
Ivan Svetunkov, ivan@svetunkov.com
Geraci Marco, Bottai Matteo (2007). Quantile regression for longitudinal data using the asymmetric Laplace distribution. Biostatistics (2007), 8, 1, pp. 140-154 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biostatistics/kxj039")}
Yu, K., & Zhang, J. (2005). A three-parameter asymmetric laplace distribution and its extension. Communications in Statistics - Theory and Methods, 34, 1867-1879. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03610920500199018")}
Distributions
x <- dalaplace(c(-100:100)/10, 0, 1, 0.2)
plot(x, type="l")
x <- palaplace(c(-100:100)/10, 0, 1, 0.2)
plot(x, type="l")
qalaplace(c(0.025,0.975), 0, c(1,2), c(0.2,0.3))
x <- ralaplace(1000, 0, 1, 0.2)
hist(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.