Learn R Programming

SafeBayes (version 1.1)

rinvGauss: The inverse Gaussian and Wald distributions

Description

Random generator for the inverse Gaussian and Wald distributions.

Usage

rinvGauss(n, nu, lambda)

Arguments

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

Value

The output values conform to the output from other such functions in R. rinvGauss() generates random numbers.

Details

This function is copied from the SuppDists package by Bob Wheeler. I have copied this function here, because the SuppDists pacakge is no longer maintained, so that I can maintain the rinvGauss function for use in the functions in this package.

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 >= 0.02$ to $lambda / nu <= 4000$.="" <="" p="">

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.

References

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.

Examples

Run this code
rinvGauss(1, 1, 16)

Run the code above in your browser using DataLab