cubfits (version 0.1-2)

Asymmetric Laplace Distribution: The Asymmetric Laplace Distribution

Description

Density, probability, quantile, random number generation, and MLE functions for the asymmetric Laplace distribution with parameters either in $ASL(theta, mu, sigma)$ or the alternative $ASL*(theta, kappa, sigma)$.

Usage

dasl(x, theta = 0, mu = 0, sigma = 1, log = FALSE) dasla(x, theta = 0, kappa = 1, sigma = 1, log = FALSE)
pasl(q, theta = 0, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE) pasla(q, theta = 0, kappa = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
qasl(p, theta = 0, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE) qasla(p, theta = 0, kappa = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
rasl(n, theta = 0, mu = 0, sigma = 1) rasla(n, theta = 0, kappa = 1, sigma = 1)
asl.optim(x)

Arguments

x, q
vector of quantiles.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.
theta
center parameter.
mu, kappa
location parameters.
sigma
shape parameter.
log, log.p
logical; if TRUE, probabilities p are given as log(p).
lower.tail
logical; if TRUE (default), probabilities are P[X <= x]="" otherwise,="" p[x=""> x].

Value

“dasl” and “dasla” give the densities, “pasl” and “pasla” give the distribution functions, “qasl” and “qasla” give the quantile functions, and “rasl” and “rasls” give the random numbers.asl.optim returns the MLE of data x including theta, mu, kappa, and sigma.

Details

The density $f(x)$ of $ASL*(theta, kappa, sigma)$ is given as $ sqrt(2) / sigma kappa / (1 + \kappa^2) exp(- sqrt(2) kappa / sigma |x - \theta|) $ if $x >= theta$, and $ sqrt(2) / sigma kappa / (1 + \kappa^2) exp(- sqrt(2) / (sigma kappa) |x - \theta|) $ if $x < theta$.

The parameter domains of ASL and ASL* are $theta in real$, $sigma > 0$, $kappa > 0$, and $mu in real$. The relation of $mu$ and $kappa$ are $ kappa = (sqrt(2 sigma^2 + mu^2) - mu) / sqrt(2 sigma)$ or $ mu = sigma / sqrt(2) (1 / kappa - kappa)$.

References

Kotz S, Kozubowski TJ, Podgorski K. (2001) ``The Laplace distribution and generalizations: a revisit with applications to communications, economics, engineering, and finance.'' Boston: Birkhauser.

Examples

Run this code
## Not run: 
# suppressMessages(library(cubfits, quietly = TRUE))
# set.seed(1234)
# 
# dasl(-2:2)
# dasla(-2:2)
# pasl(-2:2)
# pasla(-2:2)
# qasl(seq(0, 1, length = 5))
# qasla(seq(0, 1, length = 5))
# 
# dasl(-2:2, log = TRUE)
# dasla(-2:2, log = TRUE)
# pasl(-2:2, log.p = TRUE)
# pasla(-2:2, log.p = TRUE)
# qasl(log(seq(0, 1, length = 5)), log.p = TRUE)
# qasla(log(seq(0, 1, length = 5)), log.p = TRUE)
# 
# set.seed(123)
# rasl(5)
# rasla(5)
# 
# asl.optim(rasl(5000))
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace