# ghypMom: Calculate Moments of the Generalized Hyperbolic Distribution In GeneralizedHyperbolic: The Generalized Hyperbolic Distribution

## Description

Function to calculate raw moments, mu moments, central moments and moments about any other given location for the generalized hyperbolic distribution.

## Usage

 ```1 2 3``` ```ghypMom(order, mu = 0, delta = 1, alpha = 1, beta = 0, lambda = 1, param = c(mu, delta, alpha, beta, lambda), momType = c("raw", "central", "mu"), about = 0) ```

## Arguments

 `order` Numeric. The order of the moment to be calculated. Not permitted to be a vector. Must be a positive whole number except for moments about zero. `mu` mu is the location parameter. By default this is set to 0. `delta` delta is the scale parameter of the distribution. A default value of 1 has been set. `alpha` alpha is the tail parameter, with a default value of 1. `beta` beta is the skewness parameter, by default this is 0. `lambda` lambda is the shape parameter and dictates the shape that the distribution shall take. Default value is 1. `param` Numeric. The parameter vector specifying the generalized hyperbolic distribution. Of the form `c(mu, delta, alpha, beta, lambda)` (see `dghyp`). `momType` Common types of moments to be calculated, default is "raw". See Details. `about` Numeric. The point around which the moment is to be calculated.

## Details

Checking whether `order` is a whole number is carried out using the function `is.wholenumber`.

`momType` can be either "raw" (moments about zero), "mu" (moments about mu), or "central" (moments about mean). If one of these moment types is specified, then there is no need to specify the `about` value. For moments about any other location, the `about` value must be specified. In the case that both `momType` and `about` are specified and contradicting, the function will always calculate the moments based on `about` rather than `momType`.

To calculate moments of the generalized hyperbolic distribution, the function firstly calculates mu moments by formula defined below and then transforms mu moments to central moments or raw moments or moments about any other locations as required by calling `momChangeAbout`.

The mu moments are obtained from the recursion formula given in Scott, W<fc>rtz and Tran (2011).

## Value

The moment specified.

## Author(s)

David Scott [email protected]

## References

Scott, D. J., W<fc>rtz, D., Dong, C. and Tran, T. T. (2011) Moments of the generalized hyperbolic distribution. Comp. Statistics., 26, 459–476.

`ghypChangePars` and from package DistributionUtils: `logHist`, `is.wholenumber`, `momChangeAbout`, and `momIntegrated`.
Further, `ghypMean`, `ghypVar`, `ghypSkew`, `ghypKurt`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33``` ```param <- c(1, 2, 2, 1, 2) mu <- param[1] ### mu moments m1 <- ghypMean(param = param) m1 - mu ghypMom(1, param = param, momType = "mu") ## Comparison, using momIntegrated from pkg 'DistributionUtils': momIntegrated <- DistributionUtils :: momIntegrated momIntegrated("ghyp", order = 1, param = param, about = mu) ghypMom(2, param = param, momType = "mu") momIntegrated("ghyp", order = 2, param = param, about = mu) ghypMom(10, param = param, momType = "mu") momIntegrated("ghyp", order = 10, param = param, about = mu) ### raw moments ghypMean(param = param) ghypMom(1, param = param, momType = "raw") momIntegrated("ghyp", order = 1, param = param, about = 0) ghypMom(2, param = param, momType = "raw") momIntegrated("ghyp", order = 2, param = param, about = 0) ghypMom(10, param = param, momType = "raw") momIntegrated("ghyp", order = 10, param = param, about = 0) ### central moments ghypMom(1, param = param, momType = "central") momIntegrated("ghyp", order = 1, param = param, about = m1) ghypVar(param = param) ghypMom(2, param = param, momType = "central") momIntegrated("ghyp", order = 2, param = param, about = m1) ghypMom(10, param = param, momType = "central") momIntegrated("ghyp", order = 10, param = param, about = m1) ```