Density, distribution function, quantile function and random generation for the generalized asymmetric Laplace distribution with parameters mu, sigma and nu, delta.

dgal(x, delta, mu, nu, sigma, log = FALSE)

rgal(n, delta, mu, nu, sigma, seed = 0)

pgal(q, delta, mu, nu, sigma, lower.tail = TRUE, log.p = FALSE)

qgal(p, delta, mu, nu, sigma, lower.tail = TRUE, log.p = FALSE)

Arguments

x, q

vector of quantiles.

delta

A numeric value for the location parameter.

mu

A numeric value for the shift parameter.

nu

A numeric value for the shape parameter.

sigma

A numeric value for the scaling parameter.

log, log.p

logical; if TRUE, probabilities/densities \(p\) are returned as \(log(p)\).

n,

number of observations.

seed

Seed for the random generation.

lower.tail

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

p

vector of probabilities.

Value

dgal gives the density, pgal gives the distribution function, qgal gives the quantile function, and rgal generates random deviates.

Invalid arguments will result in return value NaN, with a warning.

The length of the result is determined by n for rgal.

Details

The generalized asymmetric Laplace distribution has density given by $$f(x; p, a, b) = \frac{e^{\nu+\mu(x-\delta)/\sigma^2}\sqrt{\nu\mu^2/\sigma^2+\nu^2}}{\pi\sqrt{\nu\sigma^2+(x-\delta)^2}} K_1(\sqrt{(\nu\sigma^2+(x-\delta)^2)(\mu^2/\sigma^4+\nu/\sigma^2)}),$$ where \(K_p\) is modified Bessel function of the second kind of order \(p\), \(x>0\), \(\nu>0\) and \(\mu,\delta, \sigma\in\mathbb{R}\). See Barndorff-Nielsen (1977, 1978 and 1997) for further details.

If the mixing variable \(V\) follows a Gamma distribution (same parameterization in R): $$V \sim \Gamma(h \nu, \nu),$$ then the poserior follows the GAL distribution (a special case of GIG distribution): $$ -\mu +\mu V + \sigma \sqrt{V} Z \sim GIG(h \nu - 0.5, 2 \nu + (\frac{\mu}{\sigma})^{2}, 0) $$

References

Barndorff-Nielsen, O. (1977) Exponentially decreasing distributions for the logarithm of particle size. Proceedings of the Royal Society of London.

Series A, Mathematical and Physical Sciences. The Royal Society. 353, 401–409. doi:10.1098/rspa.1977.0041

Barndorff-Nielsen, O. (1978) Hyperbolic Distributions and Distributions on Hyperbolae, Scandinavian Journal of Statistics. 5, 151–157.

See also

Examples

rgal(100, delta = 0, mu = 5, sigma = 1, nu = 1)
#>   [1] 19.84182129  7.07441404  0.55665389  1.47040707 15.82389409  4.62692309
#>   [7] 18.19969722  1.91847742  0.61738327  4.95972908  0.08309906 18.90199933
#>  [13]  1.36074938  0.61144215  5.88534453  4.61928375  0.08003763  3.21500163
#>  [19]  2.52517806 10.57327840  1.33697711  3.74429633  1.44096318  1.32713003
#>  [25]  2.01264679  0.25857494 10.69995971  0.50180448 22.89667934  2.97062113
#>  [31]  3.51326032  3.65650062  4.17958709  0.48269083  2.59707706  2.69533669
#>  [37]  3.84134054 10.57847278  6.25178555  3.44195080  3.69198716  7.72995397
#>  [43]  0.76276617 10.30785604  0.92347981  0.14578486  1.24033783  1.76750794
#>  [49]  5.78035409  3.82570631 22.29243097 -0.03887701  6.82825313 15.71816574
#>  [55]  2.39469602  5.33115251  5.89851079  9.28551041  2.36925153  0.21910692
#>  [61]  1.63803327  0.03204616  1.09730052 10.73958442  8.95064351  0.81649332
#>  [67] 10.00654365  0.24348721 12.56391046  5.04778838  0.40898336  6.56264311
#>  [73]  1.74380425 12.14970985  2.78956360 12.02548898 10.06144607  9.96724991
#>  [79]  5.75654462 23.78402206  6.83245696  0.84277953  7.68119364  3.19240980
#>  [85]  2.55236074  1.45815620  1.75046262  5.09133760 15.65037845  1.51183991
#>  [91]  5.40607440  1.94732108  3.93213632  2.65693713  3.87027143  1.85405283
#>  [97]  1.27766419  7.63751568 24.50970771  2.14000645
pgal(0.4, delta = 0, mu = 5, sigma = 1, nu = 1)
#> [1] 0.9989855
qgal(0.8, delta = 0, mu = 5, sigma = 1, nu = 1)
#> [1] 0.06083445
plot(function(x){dgal(x, delta = 0, mu = 5, sigma = 1, nu = 1)}, main =
"generalized asymmetric Laplace density", ylab = "Probability density",
xlim = c(0,10))