ALD {ald}R Documentation

The Asymmetric Laplace Distribution


Density, distribution function, quantile function and random generation for a Three-Parameter Asymmetric Laplace Distribution defined in Koenker and Machado (1999) useful for quantile regression with location parameter equal to mu, scale parameter sigma and skewness parameter p This is a special case of the skewed family of distributions in Galarza (2016) available in lqr::SKD.


dALD(y, mu = 0, sigma = 1, p = 0.5)
pALD(q, mu = 0, sigma = 1, p = 0.5, lower.tail = TRUE)
qALD(prob, mu = 0, sigma = 1, p = 0.5, lower.tail = TRUE)
rALD(n, mu = 0, sigma = 1, p = 0.5)



vector of quantiles.


vector of probabilities.


number of observations.


location parameter.


scale parameter.


skewness parameter.


logical; if TRUE (default), probabilities are P[X x] otherwise, P[X > x].


If mu, sigma or p are not specified they assume the default values of 0, 1 and 0.5, respectively, belonging to the Symmetric Standard Laplace Distribution denoted by ALD(0,1,0.5).

As discussed in Koenker and Machado (1999) and Yu and Moyeed (2001) we say that a random variable Y is distributed as an ALD with location parameter μ, scale parameter σ>0 and skewness parameter p in (0,1), if its probability density function (pdf) is given by

f(y|μ,σ,p)=\frac{p(1-p)}{σ}\exp {-ρ_{p}(\frac{y-μ}{σ})}

where ρ_p(.) is the so called check (or loss) function defined by

ρ_p(u)=u(p - I_{u<0})

, with I_{.} denoting the usual indicator function. This distribution is denoted by ALD(μ,σ,p) and it's p-th quantile is equal to μ.

The scale parameter sigma must be positive and non zero. The skew parameter p must be between zero and one (0<p<1).


dALD gives the density, pALD gives the distribution function, qALD gives the quantile function, and rALD generates a random sample.

The length of the result is determined by n for rALD, and is the maximum of the lengths of the numerical arguments for the other functions dALD, pALD and qALD.


The numerical arguments other than n are recycled to the length of the result.


Christian E. Galarza <> and Victor H. Lachos <>


Galarza Morales, C., Lachos Davila, V., Barbosa Cabral, C., and Castro Cepero, L. (2017) Robust quantile regression using a generalized class of skewed distributions. Stat,6: 113-130 doi: 10.1002/sta4.140.

Yu, K., & Zhang, J. (2005). A three-parameter asymmetric Laplace distribution and its extension. Communications in Statistics-Theory and Methods, 34(9-10), 1867-1879.

See Also



## Let's plot an Asymmetric Laplace Distribution!

sseq = seq(-40,80,0.5)
dens = dALD(y=sseq,mu=50,sigma=3,p=0.75)
plot(sseq,dens,type = "l",lwd=2,col="red",xlab="x",ylab="f(x)", main="ALD Density function")

#Look that is a special case of the skewed family in Galarza (2017)
# available in lqr package, dSKD(...,sigma = 2*3,dist = "laplace")

## Distribution Function
df = pALD(q=sseq,mu=50,sigma=3,p=0.75)
plot(sseq,df,type="l",lwd=2,col="blue",xlab="x",ylab="F(x)", main="ALD Distribution function")

##Inverse Distribution Function
prob = seq(0,1,length.out = 1000)
idf = qALD(prob=prob,mu=50,sigma=3,p=0.75)
title(main="ALD Inverse Distribution function")

#Random Sample Histogram
sample = rALD(n=10000,mu=50,sigma=3,p=0.75)
hist(sample,breaks = 70,freq = FALSE,ylim=c(0,max(dens)),main="")
title(main="Histogram and True density")

[Package ald version 1.3.1 Index]