# Inverse Gaussian distribution

Notation Probability density function Cumulative distribution function ${\displaystyle \operatorname {IG} \left(\mu ,\lambda \right)}$ ${\displaystyle \mu >0}$ ${\displaystyle \lambda >0}$ ${\displaystyle x\in (0,\infty )}$ ${\displaystyle {\sqrt {\frac {\lambda }{2\pi x^{3}}}}\exp \left[-{\frac {\lambda (x-\mu )^{2}}{2\mu ^{2}x}}\right]}$ ${\displaystyle \Phi \left({\sqrt {\frac {\lambda }{x}}}\left({\frac {x}{\mu }}-1\right)\right)}$ ${\displaystyle {}+\exp \left({\frac {2\lambda }{\mu }}\right)\Phi \left(-{\sqrt {\frac {\lambda }{x}}}\left({\frac {x}{\mu }}+1\right)\right)}$ where ${\displaystyle \Phi }$ is the standard normal (standard Gaussian) distribution c.d.f. ${\displaystyle \operatorname {E} [X]=\mu }$ ${\displaystyle \operatorname {E} [{\frac {1}{X}}]={\frac {1}{\mu }}+{\frac {1}{\lambda }}}$ ${\displaystyle \mu \left[\left(1+{\frac {9\mu ^{2}}{4\lambda ^{2}}}\right)^{\frac {1}{2}}-{\frac {3\mu }{2\lambda }}\right]}$ ${\displaystyle \operatorname {Var} [X]={\frac {\mu ^{3}}{\lambda }}}$ ${\displaystyle \operatorname {Var} [{\frac {1}{X}}]={\frac {1}{\mu \lambda }}+{\frac {2}{\lambda ^{2}}}}$ ${\displaystyle 3\left({\frac {\mu }{\lambda }}\right)^{1/2}}$ ${\displaystyle {\frac {15\mu }{\lambda }}}$ ${\displaystyle \exp \left[{{\frac {\lambda }{\mu }}\left(1-{\sqrt {1-{\frac {2\mu ^{2}t}{\lambda }}}}\right)}\right]}$ ${\displaystyle \exp \left[{{\frac {\lambda }{\mu }}\left(1-{\sqrt {1-{\frac {2\mu ^{2}\mathrm {i} t}{\lambda }}}}\right)}\right]}$

In probability theory, the inverse Gaussian distribution (also known as the Wald distribution) is a two-parameter family of continuous probability distributions with support on (0,∞).

Its probability density function is given by

${\displaystyle f(x;\mu ,\lambda )={\sqrt {\frac {\lambda }{2\pi x^{3}}}}\exp \left[-{\frac {\lambda (x-\mu )^{2}}{2\mu ^{2}x}}\right]}$

for x > 0, where ${\displaystyle \mu >0}$ is the mean and ${\displaystyle \lambda >0}$ is the shape parameter.[1]

As λ tends to infinity, the inverse Gaussian distribution becomes more like a normal (Gaussian) distribution. The inverse Gaussian distribution has several properties analogous to a Gaussian distribution. The name can be misleading: it is an "inverse" only in that, while the Gaussian describes a Brownian motion's level at a fixed time, the inverse Gaussian describes the distribution of the time a Brownian motion with positive drift takes to reach a fixed positive level.

Its cumulant generating function (logarithm of the characteristic function) is the inverse of the cumulant generating function of a Gaussian random variable.

To indicate that a random variable X is inverse Gaussian-distributed with mean μ and shape parameter λ we write ${\displaystyle X\sim \operatorname {IG} (\mu ,\lambda )\,\!}$.

## Properties

### Single parameter form

The probability density function (pdf) of inverse Gaussian distribution has a single parameter form given by

${\displaystyle f(x;\mu ,\mu ^{2})={\frac {\mu }{\sqrt {2\pi x^{3}}}}\exp \left[-{\frac {(x-\mu )^{2}}{2x}}\right].}$

In this form, the mean and variance of the distribution are equal, ${\displaystyle \mu =\sigma ^{2}.}$

Also, the cumulative distribution function (cdf) of the single parameter inverse Gaussian distribution is related to the standard normal distribution by

{\displaystyle {\begin{aligned}\Pr(Xx)&=\Phi (-z_{1})-e^{\mu }\Phi (z_{2}),&{\text{for}}&\quad x\geq \mu .\end{aligned}}}

where ${\displaystyle z_{1}={\frac {\mu }{x^{1/2}}}-x^{1/2}}$ and ${\displaystyle z_{2}={\frac {\mu }{x^{1/2}}}+x^{1/2},}$ where the ${\displaystyle \Phi }$ is the cdf of standard normal distribution. The variables ${\displaystyle z_{1}}$ and ${\displaystyle z_{2}}$ are related to each other by the identity ${\displaystyle z_{2}^{2}=z_{1}^{2}+4\mu .}$

In the single parameter form, the MGF simplifies to

${\displaystyle M(t)=\exp[\mu (1-{\sqrt {1-2t}})].}$

An inverse Gaussian distribution in double parameter form ${\displaystyle f(x;\mu ,\lambda )}$ can be transformed into a single parameter form ${\displaystyle f(y;\mu _{0},\mu _{0}^{2})}$ by appropriate scaling ${\displaystyle y={\frac {\mu ^{2}x}{\lambda }},}$ where ${\displaystyle \mu _{0}=\mu ^{3}/\lambda .}$

The standard form of inverse Gaussian distribution is

${\displaystyle f(x;1,1)={\frac {1}{\sqrt {2\pi x^{3}}}}\exp \left[-{\frac {(x-1)^{2}}{2x}}\right].}$

### Summation

If Xi has an ${\displaystyle \operatorname {IG} (\mu _{0}w_{i},\lambda _{0}w_{i}^{2})\,\!}$ distribution for i = 1, 2, ..., n and all Xi are independent, then

${\displaystyle S=\sum _{i=1}^{n}X_{i}\sim \operatorname {IG} \left(\mu _{0}\sum w_{i},\lambda _{0}\left(\sum w_{i}\right)^{2}\right).}$

Note that

${\displaystyle {\frac {\operatorname {Var} (X_{i})}{\operatorname {E} (X_{i})}}={\frac {\mu _{0}^{2}w_{i}^{2}}{\lambda _{0}w_{i}^{2}}}={\frac {\mu _{0}^{2}}{\lambda _{0}}}}$

is constant for all i. This is a necessary condition for the summation. Otherwise S would not be Inverse Gaussian distributed.

### Scaling

For any t > 0 it holds that

${\displaystyle X\sim \operatorname {IG} (\mu ,\lambda )\,\,\,\,\,\,\Rightarrow \,\,\,\,\,\,tX\sim \operatorname {IG} (t\mu ,t\lambda ).}$

### Exponential family

The inverse Gaussian distribution is a two-parameter exponential family with natural parametersλ/(2μ2) and −λ/2, and natural statistics X and 1/X.

## Relationship with Brownian motion

The stochastic process Xt given by

${\displaystyle X_{0}=0\quad }$
${\displaystyle X_{t}=\nu t+\sigma W_{t}\quad \quad \quad \quad }$

(where Wt is a standard Brownian motion with drift ${\displaystyle \nu >0}$).

Then the first passage time for a fixed level ${\displaystyle \alpha >0}$ by Xt is distributed according to an inverse-Gaussian:

${\displaystyle T_{\alpha }=\inf\{t>0\mid X_{t}=\alpha \}\sim \operatorname {IG} \left({\frac {\alpha }{\nu }},\left({\frac {\alpha }{\sigma }}\right)^{2}\right)={\frac {\alpha }{\sigma {\sqrt {2\pi x^{3}}}}}\exp \left[-{\frac {(\alpha -\nu x)^{2}}{2\sigma ^{2}x}}\right]}$

(cf. Schrödinger[2] equation 19, Smoluchowski[3], equation 8, and Folks[4], equation 1).

### When drift is zero

A common special case of the above arises when the Brownian motion has no drift. In that case, parameter μ tends to infinity, and the first passage time for fixed level α has probability density function

${\displaystyle f\left(x;0,\left({\frac {\alpha }{\sigma }}\right)^{2}\right)={\frac {\alpha }{\sigma {\sqrt {2\pi x^{3}}}}}\exp \left(-{\frac {\alpha ^{2}}{2\sigma ^{2}x}}\right)}$

(see also Bachelier[5]:74[6]:39). This is a Lévy distribution with parameters ${\displaystyle c=\left({\frac {\alpha }{\sigma }}\right)^{2}}$ and ${\displaystyle \mu =0}$.

## Maximum likelihood

The model where

${\displaystyle X_{i}\sim \operatorname {IG} (\mu ,\lambda w_{i}),\,\,\,\,\,\,i=1,2,\ldots ,n}$

with all wi known, (μλ) unknown and all Xi independent has the following likelihood function

${\displaystyle L(\mu ,\lambda )=\left({\frac {\lambda }{2\pi }}\right)^{\frac {n}{2}}\left(\prod _{i=1}^{n}{\frac {w_{i}}{X_{i}^{3}}}\right)^{\frac {1}{2}}\exp \left({\frac {\lambda }{\mu }}\sum _{i=1}^{n}w_{i}-{\frac {\lambda }{2\mu ^{2}}}\sum _{i=1}^{n}w_{i}X_{i}-{\frac {\lambda }{2}}\sum _{i=1}^{n}w_{i}{\frac {1}{X_{i}}}\right).}$

Solving the likelihood equation yields the following maximum likelihood estimates

${\displaystyle {\widehat {\mu }}={\frac {\sum _{i=1}^{n}w_{i}X_{i}}{\sum _{i=1}^{n}w_{i}}},\,\,\,\,\,\,\,\,{\frac {1}{\widehat {\lambda }}}={\frac {1}{n}}\sum _{i=1}^{n}w_{i}\left({\frac {1}{X_{i}}}-{\frac {1}{\widehat {\mu }}}\right).}$

${\displaystyle {\widehat {\mu }}}$ and ${\displaystyle {\widehat {\lambda }}}$ are independent and

${\displaystyle {\widehat {\mu }}\sim \operatorname {IG} \left(\mu ,\lambda \sum _{i=1}^{n}w_{i}\right),\qquad {\frac {n}{\widehat {\lambda }}}\sim {\frac {1}{\lambda }}\chi _{n-1}^{2}.}$

## Generating random variates from an inverse-Gaussian distribution

The following algorithm may be used.[7]

Generate a random variate from a normal distribution with a mean of 0 and 1 standard deviation

${\displaystyle \displaystyle \nu =N(0,1).}$

Square the value

${\displaystyle \displaystyle y=\nu ^{2}}$

and use this relation

${\displaystyle x=\mu +{\frac {\mu ^{2}y}{2\lambda }}-{\frac {\mu }{2\lambda }}{\sqrt {4\mu \lambda y+\mu ^{2}y^{2}}}.}$

Generate another random variate, this time sampled from a uniform distribution between 0 and 1

${\displaystyle \displaystyle z=U(0,1).}$

If ${\displaystyle z\leq {\frac {\mu }{\mu +x}}}$ then return ${\displaystyle \displaystyle x}$ else return ${\displaystyle {\frac {\mu ^{2}}{x}}.}$

Sample code in Java:

public double inverseGaussian(double mu, double lambda) {
Random rand = new Random();
double v = rand.nextGaussian();  // Sample from a normal distribution with a mean of 0 and 1 standard deviation
double y = v * v;
double x = mu + (mu * mu * y) / (2 * lambda) - (mu / (2 * lambda)) * Math.sqrt(4 * mu * lambda * y + mu * mu * y * y);
double test = rand.nextDouble();  // Sample from a uniform distribution between 0 and 1
if (test <= (mu) / (mu + x))
return x;
else
return (mu * mu) / x;
}

Wald distribution using Python with aid of matplotlib and NumPy

And to plot Wald distribution in Python using matplotlib and NumPy:

import matplotlib.pyplot as plt
import numpy as np

h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True)

plt.show()


## Related distributions

• If ${\displaystyle X\sim \operatorname {IG} (\mu ,\lambda )}$, then ${\displaystyle kX\sim \operatorname {IG} (k\mu ,k\lambda )}$ for any number ${\displaystyle k>0.}$[1]
• If ${\displaystyle X_{i}\sim \operatorname {IG} (\mu ,\lambda )\,}$ then ${\displaystyle \sum _{i=1}^{n}X_{i}\sim \operatorname {IG} (n\mu ,n^{2}\lambda )\,}$
• If ${\displaystyle X_{i}\sim \operatorname {IG} (\mu ,\lambda )\,}$ for ${\displaystyle i=1,\ldots ,n\,}$ then ${\displaystyle {\bar {X}}\sim \operatorname {IG} (\mu ,n\lambda )\,}$
• If ${\displaystyle X_{i}\sim \operatorname {IG} (\mu _{i},2\mu _{i}^{2})\,}$ then ${\displaystyle \sum _{i=1}^{n}X_{i}\sim \operatorname {IG} \left(\sum _{i=1}^{n}\mu _{i},2\left(\sum _{i=1}^{n}\mu _{i}\right)^{2}\right)\,}$

The convolution of an inverse Gaussian distribution (a Wald distribution) and an exponential (an ex-Wald distribution) is used as a model for response times in psychology,[8] with visual search as one example.[9]

## History

This distribution appears to have been first derived in 1900 by Louis Bachelier[5][6] as the time a stock reaches a certain price for the first time. In 1915 it was used independently by Erwin Schrödinger[2] and Marian v. Smoluchowski[3] as the time to first passage of a Brownian motion. In the field of reproduction modeling it is known as the Hadwiger function, after Hugo Hadwiger who described it in 1940.[10] Abraham Wald re-derived this distribution in 1944[11] as the limiting form of a sample in a sequential probability ratio test. The name inverse Gaussian was proposed by Maurice Tweedie in 1945.[12] Tweedie investigated this distribution in 1956[13] and 1957[14] [15] and established some of its statistical properties. The distribution was extensively reviewed by Folks and Chhikara in 1978.[4]

## Numeric computation and software

Despite the simple formula for the probability density function, numerical probability calculations for the inverse Gaussian distribution nevertheless require special care to achieve full machine accuracy in floating point arithmetic for all parameter values.[16] Functions for the inverse Gaussian distribution are provided for the R programming language by several packages including rmutil,[17][18] SuppDists,[19] STAR,[20] invGauss,[21] LaplacesDemon,[22] and statmod.[23]

## References

1. ^ a b Chhikara, Raj S.; Folks, J. Leroy (1989), The Inverse Gaussian Distribution: Theory, Methodology and Applications, New York, NY, USA: Marcel Dekker, Inc, ISBN 0-8247-7997-5
2. ^ a b Schrödinger, Erwin (1915), "Zur Theorie der Fall- und Steigversuche an Teilchen mit Brownscher Bewegung" [On the Theory of Fall- and Rise Experiments on Particles with Brownian Motion], Physikalische Zeitschrift (in German), 16 (16): 289–295
3. ^ a b Smoluchowski, Marian (1915), "Notiz über die Berechnung der Brownschen Molekularbewegung bei der Ehrenhaft-Millikanschen Versuchsanordnung" [Note on the Calculation of Brownian Molecular Motion in the Ehrenhaft-Millikan Experimental Set-up], Physikalische Zeitschrift (in German), 16 (17/18): 318–321
4. ^ a b Folks, J. Leroy; Chhikara, Raj S. (1978), "The Inverse Gaussian Distribution and Its Statistical Application—A Review", Journal of the Royal Statistical Society, Series B (Methodological), 40 (3): 263–275, doi:10.1111/j.2517-6161.1978.tb01039.x, JSTOR 2984691
5. ^ a b Bachelier, Louis (1900), "Théorie de la spéculation" [The Theory of Speculation] (PDF), Ann. Sci. Éc. Norm. Supér. (in French), Serie 3;17: 21–89
6. ^ a b Bachelier, Louis (1900), "The Theory of Speculation", Ann. Sci. Éc. Norm. Supér., Serie 3;17: 21–89 (Engl. translation by David R. May, 2011)
7. ^ Michael, John R.; Schucany, William R.; Haas, Roy W. (1976), "Generating Random Variates Using Transformations with Multiple Roots", The American Statistician, 30 (2): 88–90, doi:10.1080/00031305.1976.10479147, JSTOR 2683801
8. ^ Schwarz, Wolfgang (2001), "The ex-Wald distribution as a descriptive model of response times", Behavior Research Methods, Instruments, and Computers, 33 (4): 457–469, doi:10.3758/bf03195403, PMID 11816448
9. ^ Palmer, E. M.; Horowitz, T. S.; Torralba, A.; Wolfe, J. M. (2011). "What are the shapes of response time distributions in visual search?". Journal of Experimental Psychology: Human Perception and Performance. 37 (1): 58–71. doi:10.1037/a0020747. PMC 3062635. PMID 21090905.
10. ^ Hadwiger, H. (1940). "Eine analytische Reproduktionsfunktion für biologische Gesamtheiten". Skandinavisk Aktuarietidskrijt. 7 (3–4): 101–113. doi:10.1080/03461238.1940.10404802.
11. ^ Wald, Abraham (1944), "On Cumulative Sums of Random Variables", Annals of Mathematical Statistics, 15 (3): 283–296, doi:10.1214/aoms/1177731235, JSTOR 2236250
12. ^ Tweedie, M. C. K. (1945). "Inverse Statistical Variates". Nature (London). 155 (3937): 453. doi:10.1038/155453a0.
13. ^ Tweedie, M. C. K. (1956). "Some Statistical Properties of Inverse Gaussian Distributions". Virginia Journal of Science (New Series). 7 (3): 160–165.
14. ^ Tweedie, M. C. K. (1957). "Statistical Properties of Inverse Gaussian Distributions I". Annals of Mathematical Statistics. 28 (2): 362–377. JSTOR 2237158.
15. ^ Tweedie, M. C. K. (1957). "Statistical Properties of Inverse Gaussian Distributions II". Annals of Mathematical Statistics. 28 (3): 696–705. JSTOR 2237229.
16. ^ Giner, Göknur; Smyth, Gordon (August 2016). "statmod: Probability Calculations for the Inverse Gaussian Distribution". The R Journal. 8 (1): 339–351. doi:10.32614/RJ-2016-024.
17. ^ Lindsey, James (2013-09-09). "rmutil: Utilities for Nonlinear Regression and Repeated Measurements Models".
18. ^ Swihart, Bruce; Lindsey, James (2019-03-04). "rmutil: Utilities for Nonlinear Regression and Repeated Measurements Models".
19. ^ Wheeler, Robert (2016-09-23). "SuppDists: Supplementary Distributions".
20. ^ Pouzat, Christophe (2015-02-19). "STAR: Spike Train Analysis with R".
21. ^ Gjessing, Hakon K. (2014-03-29). "Threshold regression that fits the (randomized drift) inverse Gaussian distribution to survival data".
22. ^ Hall, Byron; Hall, Martina; Statisticat, LLC; Brown, Eric; Hermanson, Richard; Charpentier, Emmanuel; Heck, Daniel; Laurent, Stephane; Gronau, Quentin F.; Singmann, Henrik (2014-03-29). "LaplacesDemon: Complete Environment for Bayesian Inference".
23. ^ Giner, Göknur; Smyth, Gordon (2017-06-18). "statmod: Statistical Modeling".