Learn R Programming

VGAM (version 0.7-8)

alaplaceUC: The Laplace Distribution

Description

Density, distribution function, quantile function and random generation for the 3-parameter asymmetric Laplace distribution with location parameter location, scale parameter scale, and asymmetry parameter kappa.

Usage

dalaplace(x, location=0, scale=1, tau=0.5, kappa=sqrt(tau/(1-tau)))
palaplace(q, location=0, scale=1, tau=0.5, kappa=sqrt(tau/(1-tau)))
qalaplace(p, location=0, scale=1, tau=0.5, kappa=sqrt(tau/(1-tau)))
ralaplace(n, location=0, scale=1, tau=0.5, kappa=sqrt(tau/(1-tau)))

Arguments

x, q
vector of quantiles.
p
vector of probabilities.
n
number of observations. Positive integer of length 1.
location
the location parameter $\xi$.
scale
the scale parameter $b$. Must consist of positive values.
tau
the quantile parameter $\tau$. Must consist of values in $(0,1)$. This argument is used to specify kappa and is ignored if kappa is assigned.
kappa
the asymmetry parameter $\kappa$. Must consist of positive values.

Value

  • dalaplace gives the density, palaplace gives the distribution function, qalaplace gives the quantile function, and ralaplace generates random deviates.

Details

There are several variants of asymmetric Laplace distributions (ALDs) and this one is known as the ALD by Kotz et al. (2001). See alaplace3, the VGAM family function for estimating the three parameters by maximum likelihood estimation, for formulae and details. Apart from n, all the above arguments may be vectors and are recyled to the appropriate length if necessary.

References

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

See Also

alaplace3.

Examples

Run this code
x = seq(-5, 5, by=0.01)
loc = 0; b = 1.5; kappa = 2
plot(x, dalaplace(x, loc, b, kappa=kappa), type="l", col="blue",
     main="Blue is density, red is cumulative distribution function",
     ylim=c(0,1), sub="Purple are 5,10,...,95 percentiles", las=1, ylab="")
abline(h=0, col="blue", lty=2)
lines(qalaplace(seq(0.05,0.95,by=0.05), loc, b, kappa=kappa),
      dalaplace(qalaplace(seq(0.05,0.95,by=0.05), loc, b, kappa=kappa),
                loc, b, kappa=kappa), col="purple", lty=3, type="h")
lines(x, palaplace(x, loc, b, kappa=kappa), type="l", col="red")
abline(h=0, lty=2)
palaplace(qalaplace(seq(0.05,0.95,by=0.05), loc, b, kappa=kappa),
          loc, b, kappa=kappa)

Run the code above in your browser using DataLab