statmod: Probability Calculations for the Inverse Gaussian Distribution

The inverse Gaussian distribution (IGD) is a well known and often used probability dis tribution for which fully reliable numerical algorithms have not been available. We develop fast, reliable basic probability functions (dinvgauss, pinvgauss, qinvgauss and rinvgauss) for the IGD that work for all possible parameter values and which achieve close to full machine accuracy. The most challenging task is to compute quantiles for given cumulative probabilities and we develop a simple but elegant mathematical solution to this problem. We show that Newton’s method for finding the quantiles of a IGD always converges monotonically when started from the mode of the distribution. Simple Taylor series expansions are used to improve accuracy on the log-scale. The IGD probability functions provide the same options and obey the same conventions as do probability functions provided in the stats package.

Göknur Giner , Gordon K. Smyth

CRAN packages used

SuppDists, STAR, statmod

CRAN Task Views implied by cited packages

Distributions, HighPerformanceComputing, NumericalMathematics


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Giner & Smyth, "The R Journal: statmod: Probability Calculations for the Inverse Gaussian Distribution", The R Journal, 2016

BibTeX citation

  author = {Giner, Göknur and Smyth, Gordon K.},
  title = {The R Journal: statmod: Probability Calculations for the Inverse Gaussian Distribution},
  journal = {The R Journal},
  year = {2016},
  note = {},
  doi = {10.32614/RJ-2016-024},
  volume = {8},
  issue = {1},
  issn = {2073-4859},
  pages = {339-351}