Learn R Programming

lqr (version 5.2)

Egig: Moments of the Generalized Inverse Gaussian Distribution

Description

Expected value of X, log(X), 1/X and variance for the generalized inverse gaussian distribution. This function has been recycled from the ghyp R package.

Usage

Egig(lambda, chi, psi, func = c("x", "logx", "1/x", "var"))

Value

Egig gives the expected value of either x, 1/x, log(x) or the variance if func equals var.

Arguments

lambda

A shape and scale and parameter.

chi, psi

Shape and scale parameters. Must be positive.

func

The transformation function when computing the expected value. x is the expected value (default), log x returns the expected value of the logarithm of x, 1/x returns the expected value of the inverse of x and var returns the variance.

Author

David Luethi and Ester Pantaleo

Details

Egig with func = "log x" uses grad from the R package numDeriv. See the package vignette for details regarding the expectation of GIG random variables.

References

Dagpunar, J.S. (1989). An easily implemented generalised inverse Gaussian generator. Commun. Statist. -Simula., 18, 703--710.

Michael, J. R, Schucany, W. R, Haas, R, W. (1976). Generating random variates using transformations with multiple roots, The American Statistican, 30, 88--90.

See Also

best.lqr

Examples

Run this code
Egig(lambda = 10, chi = 1, psi = 1, func = "x")
Egig(lambda = 10, chi = 1, psi = 1, func = "var")
Egig(lambda = 10, chi = 1, psi = 1, func = "1/x")

Run the code above in your browser using DataLab