draw.inverse.gaussian {UnivRNG} | R Documentation |
Generates variation from inverse Gaussian distribution
Description
This function implements pseudo-random number generation for an inverse Gaussian distribution with pdf
f(x|\mu,\lambda)=(\frac{\lambda}{2\pi})^{1/2}x^{-3/2}e^{-\frac{\lambda(x-\mu)^2}{2\mu^2x}}
for x > 0
, \mu > 0
, and \lambda > 0
where \mu
and \lambda
are the location and scale parameters, respectively.
Usage
draw.inverse.gaussian(nrep,mu,lambda)
Arguments
nrep |
Number of data points to generate. |
mu |
Location parameter for the desired inverse Gaussian distribution. |
lambda |
Scale parameter for the desired inverse Gaussian distribution. |
Value
A list of length five containing generated data, the theoretical mean, the empirical mean, the theoretical variance, and the empirical variance with names y, theo.mean, emp.mean, theo.var, and emp.var, respectively.
References
Michael, J. R., William, R. S., & Haas, R. W. (1976). Generating random variates using transformations with multiple roots. The American Statistician, 30, 88-90.
Examples
draw.inverse.gaussian(nrep=100000,mu=1,lambda=1)
draw.inverse.gaussian(nrep=100000,mu=3,lambda=1)