Learn R Programming

VGAM (version 1.1-14)

laplace: Laplace Regression Family Function

Description

Maximum likelihood estimation of the 2-parameter classical Laplace distribution.

Usage

laplace(llocation = "identitylink", lscale = "loglink",
  ilocation = NULL, iscale = NULL, imethod = 1, zero = "scale")

Arguments

Value

An object of class "vglmff"

(see vglmff-class). The object is used by modelling functions such as vglm

and vgam.

Details

The Laplace distribution is often known as the double-exponential distribution and, for modelling, has heavier tail than the normal distribution. The Laplace density function is $$f(y) = \frac{1}{2b} \exp \left( - \frac{|y-a|}{b} \right) $$ where \(-\infty<y<\infty\), \(-\infty<a<\infty\) and \(b>0\). Its mean is \(a\) and its variance is \(2b^2\). This parameterization is called the classical Laplace distribution by Kotz et al. (2001), and the density is symmetric about \(a\).

For y ~ 1 (where y is the response) the maximum likelihood estimate (MLE) for the location parameter is the sample median, and the MLE for \(b\) is mean(abs(y-location)) (replace location by its MLE if unknown).

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

rlaplace, alaplace2 (which differs slightly from this parameterization), exponential, median.

Examples

Run this code
ldata <- data.frame(y = rlaplace(nn <- 100, 2, scale = exp(1)))
fit <- vglm(y  ~ 1, laplace, ldata, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit)
with(ldata, median(y))

ldata <- data.frame(x = runif(nn <- 1001))
ldata <- transform(ldata, y = rlaplace(nn, 2, scale = exp(-1 + 1*x)))
coef(vglm(y ~ x, laplace(iloc = 0.2, imethod = 2, zero = 1), ldata,
          trace = TRUE), matrix = TRUE)

Run the code above in your browser using DataLab