Density, distribution function, quantile function, random generator and summary function for the inverse Gaussian and Wald distributions.

```
dinvGauss(x, nu, lambda, log=FALSE)
pinvGauss(q, nu, lambda, lower.tail=TRUE, log.p=FALSE)
qinvGauss(p, nu, lambda, lower.tail=TRUE, log.p=FALSE)
rinvGauss(n, nu, lambda)
sinvGauss(nu, lambda)
```

The output values conform to the output from other such functions in R. `dinvGauss()`

gives the density, `pinvGauss()`

the distribution function and `qinvGauss()`

its inverse. `rinvGauss()`

generates random numbers. `sinvGauss()`

produces a list containing parameters corresponding to the arguments -- mean, median, mode, variance, sd, third cental moment, fourth central moment, Pearson's skewness, skewness, and kurtosis.

- x,q
vector of non-negative quantities

- p
vector of probabilities

- n
vector of numbers of observations

- nu
vector real and non-negative parameter -- the Wald distribution results when nu=1

- lambda
vector real and non-negative parameter

- log, log.p
logical vector; if TRUE, probabilities p are given as log(p)

- lower.tail
logical vector; if TRUE (default), probabilities are \(P[X <= x]\), otherwise, \(P[X > x]\)

Bob Wheeler

Probability functions:

$$f(x,\nu,\lambda)=\sqrt{\frac{\lambda}{2\pi x^3}}\exp\left[-\lambda\frac{(x-\nu)^2}{2\nu^2 x}\right] \mbox{-- the density}$$

$$F(x,\nu,\lambda)=\Phi\left[\sqrt{\frac{\lambda}{x}}\left(\frac{x}{\nu}-1\right)\right]+e^{2\lambda/\nu}\Phi\left[\sqrt{\frac{\lambda}{x}}\left(\frac{x}{\nu}+1\right)\right] \mbox{-- the distribution function}$$

where \(\Phi[]\) is the standard normal distribution function.

The calculations are accurate to at least seven significant figures over an extended range - much larger than that of any existing tables. We have tested them for \(\lambda / \nu = 10e-20\), and \(\lambda/\nu=10e4\). Accessible tables are those of Wassan and Roy (1969), which unfortunately, are sometimes good to only two significant digits. Much better tables are available in an expensive CRC Handbook (1989), which are accurate to at least 7 significant digits for \(\lambda/\nu \ge 0.02\) to \(\lambda/\nu \le 4000\).

These are first passage time distributions of Brownian motion with positive drift. See Whitmore and Seshadri (1987) for a heuristic derivation. The Wald (1947) form represents the average sample number in sequential analysis. The distribution has a non-monotonic failure rate, and is of considerable interest in lifetime studies: Ckhhikara and Folks (1977). A general reference is Seshadri (1993).

This is an extremely difficult distribution to treat numerically, and it would not have been possible without some extraordinary contributions. An elegant derivation of the distribution function is to be found in Shuster (1968). The first such derivation seems to be that of Zigangirov (1962), which because of its inaccessibility, the author has not read. The method of generating random numbers is due to Michael, Schucany, and Haas (1976). The approximation of Whitmore and Yalovsky (1978) makes it possible to find starting values for inverting the distribution. All three papers are short, elegant, and non- trivial.

Ckhhikara, R.S. and Folks, J.L. (1977) The inverse Gaussian distribution as a lifetime model. *Technometrics.* **19-4.** 461-468.

CRC Handbook. (1989). *Percentile points of the inverse Gaussian distribution.* J.A. Koziol (ed.) Boca Raton, FL.

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

Seshadri, V. (1993). *The inverse Gaussian distribution.* Clarendon, Oxford

Shuster, J. (1968). On the inverse Gaussian distribution function. Jour. *Am. Stat. Assoc.* **63.** 1514-1516.

Wasan, M.T. and Roy, L.K. (1969). Tables of inverse Gaussian percentage points. *Technometrics.* **11-3.** 591-604.

Wald, A. (1947). *Sequential analysis.* Wiley, NY

Whitmore, G.A. and Seshadri, V. (1987). A heuristic derivation of the inverse Gaussian distribution. *American Statistician.* **41-4.** 280-281.

Whitmore, G.A. and Yalovsky, M. (1978). A normalizing logarithmic transformation for inverse Gaussian random variables. *Technometrics.* **20-2.** 207-208.

Zigangirov, K.S. (1962). Expression for the Wald distribution in terms of normal distribution. *Radiotech.Electron.* **7.** 164-166.

```
pinvGauss(1, 1, 16)
pinvGauss(c(.65,1,1.45), 1, 16) ## approximately 5% 50% and 95%
pars<-sinvGauss(1, 16)
plot(function(x)dinvGauss(x,1, 16),pars$Mean-3*pars$SD,pars$Mean+3*pars$SD)
```

Run the code above in your browser using DataLab