invgauss {statmod} | R Documentation |
Density, cumulative probability, quantiles and random generation for the inverse Gaussian distribution.
dinvgauss(x, mean=1, shape=NULL, dispersion=1, log=FALSE) pinvgauss(q, mean=1, shape=NULL, dispersion=1, lower.tail=TRUE, log.p=FALSE) qinvgauss(p, mean=1, shape=NULL, dispersion=1, lower.tail=TRUE, log.p=FALSE, maxit=50L, tol=1e-5, trace=FALSE) rinvgauss(n, mean=1, shape=NULL, dispersion=1)
x,q |
vector of quantiles. |
p |
vector of probabilities. |
n |
sample size. If |
mean |
vector of (positive) means. |
shape |
vector of (positive) shape parameters. |
dispersion |
vector of (positive) dispersion parameters. |
lower.tail |
logical; if |
log |
logical; if |
log.p |
logical; if |
maxit |
maximum number of Newton iterations used to find |
tol |
small positive numeric value giving the convergence tolerance for the quantile. |
trace |
logical, if |
The inverse Gaussian distribution takes values on the positive real line (Tweedie, 1957; Chhikara and Folks, 1989).
It is somewhat more right skew than the gamma distribution, with variance given by dispersion*mean^3
.
The shape and dispersion parameters are alternative parametrizations for the variability, the shape being the inverse of the dispersion.
The distribution has applications in reliability and survival analysis, and is one of the response distributions used in generalized linear models.
pinvgauss
uses a result from Chhikara and Folks (1974), with enhancements for right tails and log-probabilities.
rinvgauss
uses an algorithm from Michael et al (1976).
qinvgauss
uses code and algorithm from Giner and Smyth (2014).
Output values give density (dinvgauss
), probability (pinvgauss
), quantile (qinvgauss
) or random sample (rinvgauss
) for the inverse Gaussian distribution with mean mean
and dispersion dispersion
.
Output is a vector of length equal to the maximum length of any of the arguments x
, q
, mean
, shape
or dispersion
.
If the first argument is the longest, then all the attributes of the input argument are preserved on output, for example, a matrix x
will give a matrix on output.
Elements of q
or p
that are missing will cause the corresponding elements of the result to be missing, as will non-positive values for mean
or dispersion
.
Gordon Smyth with contributions from Paul Bagshaw, Centre National d'Etudes des Telecommunications, France, and Trevor Park, Department of Statistics, University of Florida
Chhikara, R. S., and Folks, J. L., (1989). The inverse Gaussian distribution: Theory, methodology and applications. Marcel Dekker, New York.
Chhikara, R. S., and Folks, J. L., (1974). Estimation of the inverse Gaussian distribution function. Journal of the American Statistical Association 69, 250-254.
Giner, G., and Smyth, G. K. (2014). A monotonically convergent Newton iteration for the quantiles of any unimodal distribution, with application to the inverse Gaussian distribution. http://www.statsci.org/smyth/pubs/qinvgaussPreprint.pdf
Michael, J. R., Schucany, W. R., and Haas, R. W. (1976). Generating random variates using transformations with multiple roots. The American Statistician, 30, 88–90.
Tweedie, M. C. (1957). Statistical Properties of Inverse Gaussian Distributions I. Annals of Mathematical Statistics 28, 362-377.
dinvGauss
, pinvGauss
, qinvGauss
and rinvGauss
in the SuppDists package.
q <- rinvgauss(20,mean=1,dispersion=0.5) # generate vector of 20 random numbers p <- pinvgauss(q,mean=1,dispersion=0.5) # p should be uniform