udgamma function

UNU.RAN object for Gamma distribution

UNU.RAN object for Gamma distribution

Create UNU.RAN object for a Gamma distribution with parameters shape and scale.

[Distribution] -- Gamma.

udgamma(shape, scale=1, lb=0, ub=Inf)

Arguments

  • shape: (strictly positive) shape parameter.
  • scale: (strictly positive) scale parameter.
  • lb: lower bound of (truncated) distribution
  • ub: upper bound of (truncated) distribution

Details

The Gamma distribution with parameters shape =a= a

and scale =s= s has density

f(x)=1σαΓ(α)xα1ex/σf(x)=1/(saGamma(a))x(a1)exp(x/s) f(x) = \frac{1}{{\sigma}^{\alpha}\Gamma(\alpha)} {x}^{\alpha-1} e^{-x/\sigma}f(x) = 1/(s^a Gamma(a)) x^(a-1) exp(-x/s)

for x0x \ge 0, a>0a > 0 and s>0s > 0. (Here Gamma(a)Gamma(a) is the function implemented by 's gamma() and defined in its help.)

The domain of the distribution can be truncated to the interval (lb,ub).

Returns

An object of class "unuran.cont".

See Also

unuran.cont.

References

N.L. Johnson, S. Kotz, and N. Balakrishnan (1994): Continuous Univariate Distributions, Volume 1. 2nd edition, John Wiley & Sons, Inc., New York. Chap. 17, p. 337.

Author(s)

Josef Leydold and Wolfgang H"ormann unuran@statmath.wu.ac.at .

Examples

## Create distribution object for gamma distribution distr <- udgamma(shape=4) ## Generate generator object; use method PINV (inversion) gen <- pinvd.new(distr) ## Draw a sample of size 100 x <- ur(gen,100)
  • Maintainer: Josef Leydold
  • License: GPL (>= 2)
  • Last published: 2025-04-07