laplace: Laplace Regression Family Function

Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples

View source: R/family.qreg.R

Description

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

Usage

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

Arguments

llocation, lscale

Character. Parameter link functions for location parameter a and scale parameter b. See Links for more choices.

ilocation, iscale

Optional initial values. If given, it must be numeric and values are recycled to the appropriate length. The default is to choose the value internally.

imethod

Initialization method. Either the value 1 or 2.

zero

See CommonVGAMffArguments for information.

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) = (1/(2b)) exp( -|y-a|/b )

where -Inf<y<Inf, -Inf<a<Inf 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).

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.

Warning

This family function has not been fully tested. The MLE regularity conditions do not hold for this distribution, therefore misleading inferences may result, e.g., in the summary and vcov of the object. Hence this family function might be withdrawn from VGAM in the future.

Note

This family function uses Fisher scoring. Convergence may be slow for non-intercept-only models; half-stepping is frequently required.

Author(s)

T. W. Yee

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ldata <- data.frame(y = rlaplace(nn <- 100, loc = 2, scale = exp(1)))
fit <- vglm(y  ~ 1, laplace, data = ldata, trace = TRUE, crit = "l")
coef(fit, matrix = TRUE)
Coef(fit)
with(ldata, median(y))

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

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -270.6351
VGLM    linear loop  2 :  loglikelihood = -270.63491
VGLM    linear loop  3 :  loglikelihood = -270.63491
            location loge(scale)
(Intercept) 1.808314    1.013202
location    scale 
1.808314 2.754406 
[1] 1.808314
VGLM    linear loop  1 :  loglikelihood = -2438.45022
VGLM    linear loop  2 :  loglikelihood = -2580.31389
Taking a modified step.
VGLM    linear loop  2 :  loglikelihood = -2065.34264
VGLM    linear loop  3 :  loglikelihood = -2001.714
VGLM    linear loop  4 :  loglikelihood = -1459.61704
VGLM    linear loop  5 :  loglikelihood = -1232.47531
VGLM    linear loop  6 :  loglikelihood = -1194.61584
VGLM    linear loop  7 :  loglikelihood = -1193.36466
VGLM    linear loop  8 :  loglikelihood = -1193.36082
VGLM    linear loop  9 :  loglikelihood = -1193.3604
VGLM    linear loop  10 :  loglikelihood = -1193.35998
VGLM    linear loop  11 :  loglikelihood = -1193.36091
Taking a modified step...
VGLM    linear loop  11 :  loglikelihood = -1193.35994
VGLM    linear loop  12 :  loglikelihood = -1193.36103
Taking a modified step.......
VGLM    linear loop  12 :  loglikelihood = -1193.35994
VGLM    linear loop  13 :  loglikelihood = -1193.36102
Taking a modified step.......
VGLM    linear loop  13 :  loglikelihood = -1193.35993
            location loge(scale)
(Intercept) 2.016141   -1.017678
x           0.000000    1.018386
Warning message:
In vglm.fitter(x = x, y = y, w = w, offset = offset, Xm2 = Xm2,  :
  some quantities such as z, residuals, SEs may be inaccurate due to convergence at a half-step

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.