GHYP: Uni- and Multivariate Generalized Hyperbolic Distribution In QRM: Provides R-Language Code to Examine Quantitative Risk Management Concepts

Description

Values of density and random number generation for uni- and multivariate Generalized Hyperbolic distribution in new QRM parameterization (chi, psi, gamma) and in standard parametrization (alpha, beta, delta); univariate only. See pp. 77–81 in QRM. The special case of a multivariate symmetric GHYP is implemented seperately as function `dsmghyp()`.

Usage

 ```1 2 3 4 5 6 7``` ```dghyp(x, lambda, chi, psi, mu = 0, gamma = 0, log = FALSE) dmghyp(x, lambda, chi, psi, mu, Sigma, gamma, log = FALSE) dsmghyp(x, lambda, chi, psi, mu, Sigma, log = FALSE) dghypB(x, lambda, delta, alpha, beta = 0, mu = 0, log = FALSE) rghyp(n, lambda, chi, psi, mu = 0, gamma = 0) rmghyp(n, lambda, chi, psi, Sigma, mu, gamma) rghypB(n, lambda, delta, alpha, beta = 0, mu = 0) ```

Arguments

 `alpha` `numeric`, parameter(s). `beta` `numeric`, skewness parameter. `chi` `numeric`, mixing parameter(s). `delta` `numeric`, parameter(s). `gamma` `numeric`, skewness parameter(s). `lambda` `numeric`, mixing parameter(s). `log` `logical`, should log density be returned; default is `FALSE`. `mu` `numeric`, location parameter(s). `n` `integer`, count of random variates. `psi` `numeric`, mixing parameter(s). `Sigma` `matrix`, dispersion matrix for multivaraiate GHYP. `x` `vector`, values to evaluate density.

Details

The univariate QRM parameterization is defined in terms of parameters chi, psi, gamma instead of the alpha, beta, delta model used by Blaesild (1981). If gamma = 0, a normal variance mixture where the mixing variable W has a Generalized Inverse Gaussian distribution (GIG) with parameters lambda, chi, psi is given, with heavier tails. If gamma > 0, a normal mean-variance mixture where the mean is also perturbed to equal mu + (W * gamma) which introduces asymmetry as well, is obtained. Values for lambda and mu are identical in both QRM and B parameterizations. The dispersion matrix Sigma does not appear as argument in the univariate case since its value is identically one.

Value

numeric, value(s) of density or log-density (dghyp, dmghyp, dsmghyp and dghypB) or random sample (rghyp, rmghyp, rghypB)

Note

Density values from dgyhp() should be identical to those from dghypB() if the alpha, beta, delta parameters of the B type are translated to the corresponding gamma,chi, psi parameters of the QRM type by formulas on pp 79–80 in QRM.
If gamma is a vector of zeros, the distribution is elliptical and `dsmghyp()` is utilised in `dmghyp()`. If lambda = (d + 1) / 2, a d-dimensional hyperbolic density results. If lambda = 1, the univariate marginals are one-dimensional hyperbolics. If lambda = -1/2, the distribution is Normal Inverse Gaussian (NIG). If lambda > 0 and chi = 0, one obtains a Variance Gamma distribution (VG). If one can define a constant nu such that lambda = (-1/2) * nu and chi = nu then one obtains a multivariate skewed-t distribution. See p. 80 of QRM for details.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```old.par <- par(no.readonly = TRUE) par(mfrow = c(2, 2)) ll <- c(-4, 4) BiDensPlot(func = dmghyp, xpts = ll, ypts = ll, mu = c(0, 0), Sigma = equicorr(2, -0.7), lambda = 1, chi = 1, psi = 1, gamma = c(0, 0)) BiDensPlot(func = dmghyp, type = "contour", xpts = ll, ypts = ll, mu = c(0, 0), Sigma = equicorr(2, -0.7), lambda = 1, chi = 1, psi = 1, gamma = c(0, 0)) BiDensPlot(func = dmghyp, xpts = ll, ypts = ll, mu = c(0, 0), Sigma = equicorr(2, -0.7), lambda = 1, chi = 1, psi = 1, gamma = c(0.5, -0.5)) BiDensPlot(func = dmghyp, type = "contour", xpts = ll, ypts = ll, mu = c(0, 0), Sigma = equicorr(2, -0.7), lambda = 1, chi = 1, psi = 1, gamma = c(0.5, -0.5)) par(old.par) ```

Example output

```Loading required package: gsl

Attaching package: 'QRM'

The following object is masked from 'package:base':

lbeta

Warning messages:
1: In (psi + Offset) * (chi + Q) :
Recycling array of length 1 in array-vector arithmetic is deprecated.

2: In (psi + Offset) * (chi + Q) :
Recycling array of length 1 in array-vector arithmetic is deprecated.

3: In log.const.top + log.top :
Recycling array of length 1 in array-vector arithmetic is deprecated.

Warning messages:
1: In (psi + Offset) * (chi + Q) :
Recycling array of length 1 in array-vector arithmetic is deprecated.