gigMom function

Calculate Moments of the Generalized Inverse Gaussian Distribution

Calculate Moments of the Generalized Inverse Gaussian Distribution

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.

gigRawMom(order, Theta) gigMom(order, Theta, 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.
  • Theta: Numeric. The parameter vector specifying the GIG distribution. Of the form c(lambda, chi, psi) (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 Theta 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 omegaomega and etaeta, given as parameterization 3 in gigChangePars. Then the raw moment of the GIG distribution of order kk is given by

ηkKλ+k(ω)/Kλ(ω) \eta^k K_{\lambda+k}(\omega)/K_{\lambda}(\omega)%eta^k K_(lambda+k)(omega)/K_lambda(omega)

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

The raw moment of the gamma distribution of order kk with shape parameter alphaalpha and rate parameter betabeta is given by

βkΓ(α+k)/Γ(α) \beta^{-k}\Gamma(\alpha+k)/\Gamma(\alpha)%beta^(-k)Gamma(alpha+k)/Gamma(alpha)

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

Returns

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

References

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

Author(s)

David Scott d.scott@auckland.ac.nz

See Also

gigCheckPars, gigChangePars, is.wholenumber, momChangeAbout, momIntegrated, gigMean, gigVar, gigSkew, gigKurt.

Examples

### Raw moments of the generalized inverse Gaussian distribution Theta <- c(-0.5,5,2.5) gigRawMom(1, Theta) momIntegrated("gig", order = 1, param = Theta, about = 0) gigRawMom(2, Theta) momIntegrated("gig", order = 2, param = Theta, about = 0) gigRawMom(10, Theta) momIntegrated("gig", order = 10, param = Theta, about = 0) gigRawMom(2.5, Theta) ### Moments of the generalized inverse Gaussian distribution Theta <- c(-0.5,5,2.5) (m1 <- gigRawMom(1, Theta)) gigMom(1, Theta) gigMom(2, Theta, m1) (m2 <- momIntegrated("gig", order = 2, param = Theta, about = m1)) gigMom(1, Theta, m1) gigMom(3, Theta, m1) momIntegrated("gig", order = 3, param = Theta, about = m1) ### Raw moments of the gamma distribution shape <- 2 rate <- 3 Theta <- c(shape, rate) gammaRawMom(1, shape, rate) momIntegrated("gamma", order = 1, param = Theta, about = 0) gammaRawMom(2, shape, rate) momIntegrated("gamma", order = 2, param = Theta, about = 0) gammaRawMom(10, shape, rate) momIntegrated("gamma", order = 10, param = Theta, about = 0) ### Moments of the inverse gamma distribution Theta <- c(-0.5,5,0) gigRawMom(2, Theta) # Inf gigRawMom(-2, Theta) momIntegrated("invgamma", order = -2, param = c(-Theta[1],Theta[2]/2), about = 0) ### An example where the moment is infinite: inverse gamma Theta <- c(-0.5,5,0) gigMom(1, Theta) gigMom(2, Theta)