## Abstract

The generalized inverse Gaussian distribution has become quite popular in financial engineering. The most popular random variate generator is due to Dagpunar (Commun. Stat., Simul. Comput. 18:703–710, 1989). It is an acceptance-rejection algorithm method based on the Ratio-of-Uniforms method. However, it is not uniformly fast as it has a prohibitive large rejection constant when the distribution is close to the gamma distribution. Recently some papers have discussed universal methods that are suitable for this distribution. However, these methods require an expensive setup and are therefore not suitable for the varying parameter case which occurs in, e.g., Gibbs sampling. In this paper we analyze the performance of Dagpunar’s algorithm and combine it with a new rejection method which ensures a uniformly fast generator. As its setup is rather short it is in particular suitable for the varying parameter case.

This is a preview of subscription content, access via your institution.

## References

Eberlein, E., Keller, U.: Hyperbolic distributions in finance. Bernoulli

**1**, 281–299 (1995)Seshadri, V.: The Inverse Gaussian Distribution. Lecture Notes in Statistics, vol. 137. Springer, New York (1999)

Barndorff-Nielsen, O., Blæsild, P., Halgreen, C.: First hitting time models for the generalized inverse Gaussian distribution. Stoch. Process. Appl.

**7**(1), 49–54 (1978). doi:10.1016/0304-4149(78)90036-4Jørgensen, B.: Statistical Properties of the Generalized Inverse Gaussian Distribution. Lecture Notes in Statistics, vol. 9. Springer, New York (1982)

Johnson, N., Kotz, S., Balakrishnan, N.: Continuous Univariate Distributions vol. 1, 2nd edn. Wiley, New York (1994)

Abramowitz, M., Stegun, I.A. (eds.): Handbook of Mathematical Functions 9th edn. Dover, New York (1972). ISBN 0486-612-724

Dagpunar, J.S.: An easily implemented generalised inverse Gaussian generator. Commun. Stat., Simul. Comput.

**18**, 703–710 (1989)Lehner, K.: Erzeugung von Zufallszahlen aus zwei exotischen Verteilungen, Diploma Thesis, Tech. Univ. Graz, Austria, 107 pp. (1989)

Atkinson, A.C.: The simulation of generalized inverse Gaussian and hyperbolic random variables. SIAM J. Sci. Stat. Comput.

**3**, 502–515 (1982)Dagpunar, J.S.: Simulation and Monte Carlo with Applications in Finance and MCMC. Wiley, New York (2007)

Leydold, J., Hörmann, W.: Generating generalized inverse Gaussian random variates by fast inversion. Comput. Stat. Data Anal.

**55**(1), 213–217 (2011). doi:10.1016/j.csda.2010.07.011Derflinger, G., Hörmann, W., Leydold, J.: Random variate generation by numerical inversion when only the density is known. ACM Trans. Model. Comput. Simul.

**20**(4), 1-25 (2010)Hörmann, W., Leydold, J., Derflinger, G.: Automatic Nonuniform Random Variate Generation. Springer, Berlin (2004)

Ahrens, J.H.: A one-table method for sampling from continuous and discrete distributions. Computing

**54**(2), 127–146 (1995)Kinderman, A.J., Monahan, J.F.: Computer generation of random variables using the ratio of uniform deviates. ACM Trans. Math. Softw.

**3**(3), 257–260 (1977)Leydold, J.: Automatic sampling with the Ratio-of-Uniforms method. ACM Trans. Math. Softw.

**26**(1), 78–98 (2000). doi:10.1145/347837.347863Hörmann, W.: A rejection technique for sampling from T-concave distributions. ACM Trans. Math. Softw.

**21**(2), 182–193 (1995)Devroye, L.: Non-Uniform Random Variate Generation. Springer, New York (1986)

Devroye, L.: A simple algorithm for generating random variates with a log-concave density. Computing

**33**(3–4), 247–257 (1984)Leydold, J.: A simple universal generator for continuous and discrete univariate T-concave distributions. ACM Trans. Math. Softw.

**27**(1), 66–82 (2001)Dagpunar, J.: In: Principles of Random Variate Generation. Clarendon, Oxford (1988)

## Acknowledgements

The authors gratefully acknowledge the useful suggestions of the area editor and two anonymous referees that helped to improve the presentation of the paper.

## Author information

### Affiliations

### Corresponding author

## Appendix

### Appendix

### Proof of Lemma 11

Let *λ*∈[0,1) be fixed. Recall that . Notice that does not contain any point left of the line *u*=−*mv* since we have used *μ*=*m* in (3), i.e., we have shifted quasi-density *g* by the mode *m* to the left, see Fig. 5. Consequently, −*mv*
^{+}≤*u*
^{−} and . Let *x*
^{+} defined as in Sect. 2, i.e., it is the unique root of (5) greater than *m*. Thus \((x-m)\sqrt{g(x)}\) is monotonically increasing in [*m*,*x*
^{+}].

Now choose *x*
_{1}∈(0,*x*
^{+}−*m*) and let (*u*
_{1},*v*
_{1}) be the point on the boundary of corresponding to *x*
_{1}, i.e., \(v_{1}=\sqrt{g(x_{1}+m)}\) and *u*
_{1}=*xv*
_{1}. Then does not intersect the open rectangle (*u*
_{1},*u*
^{+})×(*v*
_{1},*v*
^{+}) and thus

We therefore find

Now let

It is the unique maximum of \(x\sqrt{g(x)}\), see Sect. 5. Since \(((x-m)\sqrt{g(x)} )'\geq (x\sqrt{g(x)} )'\) for all *x*≥*m*, we find \(x_{0}^{+}\leq x^{+}\). Now define

Clearly \(u^{*}\leq u^{+}=\sup (x-m)\sqrt{g(x)}\), and thus *ε*=*u*
^{+}−*u*
^{∗}≥0. From (10) we then obtain

Now set

We first have to check whether the condition *x*
_{1}∈(0,*x*
^{+}−*m*) is fulfilled. For the limits *β*→0 we find

An immediate consequence is that for sufficiently small *β*>0, \(x_{1}(\beta) < x_{0}^{+}(\beta)-m(\beta) \leq x^{+}(\beta)-m(\beta)\) which shows that *x*
_{1}(*β*)∈(0,*x*
^{+}−*m*) when *β* is close enough to zero. Thus inequality (11) holds. Moreover,

For the denominators in (11) we find

Finally,

Collecting all limits we find that all fractions on the right hand side of inequality (11) converge to 0 and thus as claimed.

## Rights and permissions

## About this article

### Cite this article

Hörmann, W., Leydold, J. Generating generalized inverse Gaussian random variates.
*Stat Comput* **24, **547–557 (2014). https://doi.org/10.1007/s11222-013-9387-3

Received:

Accepted:

Published:

Issue Date:

### Keywords

- Random variate generation
- Generalized inverse Gaussian distribution
- Varying parameters