Generates random variables from a Gamma sampling model.

rvgamma(n = 1, shape, rate = 1, scale = 1/rate)

Arguments

n

integer: number of variables to generate

shape

shape parameter, may be a rv

rate

rate parameter, may be a rv

scale

inverse of rate, may be specified optionally instead of rate

Value

A random vector (rv object).

Details

rvngamma(n, shape, rate) is equivalent to rvgamma(n, 1/3 + shape, rate).

References

Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.

See also vignette("rv").

Author

Jouni Kerman jouni@kerman.com

Examples


  round(rvmedian(rvngamma(n=1, shape=1:10, rate=1)), 1) ## close to 1:10
#>  [1]  1.0  2.1  3.0  4.2  5.2  6.2  6.8  7.9  9.1 10.6