ALD: The Asymmetric Laplace Distribution In ald: The Asymmetric Laplace Distribution

Description

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.

Usage

 1 2 3 4 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) 

Arguments

 y,q vector of quantiles. prob vector of probabilities. n number of observations. mu location parameter. sigma scale parameter. p skewness parameter. lower.tail logical; if TRUE (default), probabilities are P[X ≤ x] otherwise, P[X > x].

Details

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).

Value

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.

Note

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

Author(s)

Christian E. Galarza <cgalarza88@gmail.com> and Victor H. Lachos <hlachos@ime.unicamp.br>

References

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.

momentsALD,likALD,mleALD

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 26 27 28 ## Let's plot an Asymmetric Laplace Distribution! ##Density library(ald) 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") abline(h=1,lty=2) ##Inverse Distribution Function prob = seq(0,1,length.out = 1000) idf = qALD(prob=prob,mu=50,sigma=3,p=0.75) plot(prob,idf,type="l",lwd=2,col="gray30",xlab="x",ylab=expression(F^{-1}~(x))) title(main="ALD Inverse Distribution function") abline(v=c(0,1),lty=2) #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") lines(sseq,dens,col="red",lwd=2) 

Example output




ald documentation built on April 5, 2021, 1:06 a.m.