# u4_asl: The Asymmetric Laplace Distribution In snoweye/cubfits: Codon Usage Bias Fits

## 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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ``` 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].

## Details

The density f(x) of ASL*(theta, kappa, sigma) is given as sqrt(2) / sigma kappa / (1 + κ^2) exp(- sqrt(2) kappa / sigma |x - θ|) if x >= theta, and sqrt(2) / sigma kappa / (1 + κ^2) exp(- sqrt(2) / (sigma kappa) |x - θ|) 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).

## 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`.

## Author(s)

Wei-Chen Chen [email protected].

## 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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```## 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) ```

snoweye/cubfits documentation built on May 26, 2017, 1:28 p.m.