Learn R Programming

ald (version 1.3.1)

mleALD: Maximum Likelihood Estimators (MLE) for the Asymmetric Laplace Distribution

Description

Maximum Likelihood Estimators (MLE) for the 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.

Usage

mleALD(y, initial = NA)

Arguments

y

observation vector.

initial

optional vector of initial values c(\(\mu,\sigma,p\)).

Value

The function returns a list with two objects

iter

iterations to reach convergence.

par

vector of Maximum Likelihood Estimators.

Details

The algorithm computes iteratevely the MLE's via the combination of the MLE expressions for \(\mu\) and \(\sigma\), and then maximizing with rescpect to \(p\) the Log-likelihood function (likALD) using the well known optimize R function. By default the tolerance is 10^-5 for all parameters.

References

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

ALD,momentsALD,likALD

Examples

Run this code
# NOT RUN {
## Let's try this function

param = c(-323,40,0.9)
y = rALD(10000,mu = param[1],sigma = param[2],p = param[3])  #A random sample
res = mleALD(y)

#Comparing
cbind(param,res$par)

#Let's plot

seqq = seq(min(y),max(y),length.out = 1000)
dens = dALD(y=seqq,mu=res$par[1],sigma=res$par[2],p=res$par[3])
hist(y,breaks=50,freq = FALSE,ylim=c(0,max(dens)))
lines(seqq,dens,type="l",lwd=2,col="red",xlab="x",ylab="f(x)", main="ALD Density function")

# }

Run the code above in your browser using DataLab