The Gamma Distribution

Share:

Description

Density, and random generation for the Gamma distribution with parameters shape and scale.

Usage

1
2
gdgamma(x, shape, rate = 1, scale = 1/rate, log = FALSE, type = "d")
grgamma(n, shape, rate = 1, scale = 1/rate, type = "d")

Arguments

x

vector of quantiles

n

number of random values to return

shape,scale

shape and scale parameters. Must be positive, scale strictly

rate

an alternative way to specify the scale

log

logical; if TRUE, probabilities/densities p are returned as log(p)

type

specify the type; may be "double", "single" (or short form "d" or "s")

Details

Works in much the same way as the R base functions.

Value

gdgamma gives the density and grgamma generates random deviates.

Author(s)

Nathan Morris

References

Random gamma simulation was implemented using the algorithm described in: Marsaglia and Tsang (2000) A Simple Method for Generating Gamma Variables. ACM Transactions on Mathematical Software. Volume 26 Issue 3, Pages 363-372.

See Also

dgamma

Examples

1
myRndNums = grgamma(10, c(1,2))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.