# gigMom: Calculate Moments of the Generalized Inverse Gaussian... In sjp/GeneralizedHyperbolic: The generalized hyperbolic distribution

## Description

Functions to calculate raw moments and moments about a given location for the generalized inverse Gaussian (GIG) distribution, including the gamma and inverse gamma distributions as special cases.

## Usage

 1 2 3 4 5 gigRawMom(order, chi = 1, psi = 1, lambda = 1, param = c(chi, psi, lambda)) gigMom(order, chi = 1, psi = 1, lambda = 1, param = c(chi, psi, lambda), about = 0) gammaRawMom(order, shape = 1, rate = 1, scale = 1 / rate)

## 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. chi A shape parameter that by default holds a value of 1. psi Another shape parameter that is set to 1 by default. lambda Shape parameter of the GIG distribution. Common to all forms of parameterization. By default this is set to 1. param Numeric. The parameter vector specifying the GIG distribution. Of the form c(chi, psi, lambda) (see dgig). about Numeric. The point around which the moment is to be calculated. shape Numeric. The shape parameter, must be non-negative, not permitted to be a vector. scale Numeric. The scale parameter, must be positive, not permitted to be a vector. rate Numeric. The rate parameter, an alternative way to specify the scale.

## Details

The vector param of parameters is examined using gigCheckPars to see if the parameters are valid for the GIG distribution and if they correspond to the special cases which are the gamma and inverse gamma distributions. Checking of special cases and valid parameter vector values is carried out using the function gigCheckPars. Checking whether order is a whole number is carried out using the function is.wholenumber.

Raw moments (moments about zero) are calculated using the functions gigRawMom or gammaRawMom. For moments not about zero, the function momChangeAbout is used to derive moments about another point from raw moments. Note that raw moments of the inverse gamma distribution can be obtained from the raw moments of the gamma distribution because of the relationship between the two distributions. An alternative implementation of raw moments of the gamma and inverse gamma distributions may be found in the package actuar and these may be faster since they are written in C.

To calculate the raw moments of the GIG distribution it is convenient to use the alternative parameterization of the GIG in terms of omega and eta, given as parameterization 3 in gigChangePars. Then the raw moment of the GIG distribution of order k is given by

eta^k K_(lambda+k)(omega)/K_lambda(omega)

where K_lambda() is the modified Bessel function of the third kind of order lambda.

The raw moment of the gamma distribution of order k with shape parameter alpha and rate parameter beta is given by

beta^(-k)Gamma(alpha+k)/Gamma(alpha)

The raw moment of order k of the inverse gamma distribution with shape parameter alpha and rate parameter beta is the raw moment of order -k of the gamma distribution with shape parameter alpha and rate parameter 1/beta.

## Value

The moment specified. In the case of raw moments, Inf is returned if the moment is infinite.

## Author(s)

David Scott [email protected]

## References

Paolella, Marc S. (2007) Intermediate Probability: A Computational Approach, Chichester: Wiley