Gamma Distribution

Gamma distribution that has parameters α, β > 0 is described with probability density function:

Where the function Г(α) looks as follows:

When modeling random values ~ Г(α, β) scaling of gamma distribution by the parameter β is taken into account. First, the model X~ Г(α, 1) is created for β = 1, to move to gamma value with other values of the β parameter, it is required to multiply X = β·X1.

To generate values from the distribution Г(α, 1), one can use three algorithms, each of which is valid at its range of α values:

    1. The number from the uU(0, 1) standard uniform distribution is generated and the = (exp + α) / exp and b·u1 values are calculated. If > 1, go to the step 3. Otherwise, go to the step 2.

    2. Assume that P1/α, then generate the value uU(0, 1). If u≤ exp[Y], the value Y is returned. Otherwise, return to the step 1.

    3. Assume that = –ln [(– P)/α], then generate the value u~ U(0, 1). If u≤ Yα – 1, the value Y is returned. Otherwise, return to the step 1.

    1. Calculate values of constants: , = α – ln 4, = α + 1/α, = 4.5 and = 1 + ln Q.

    2. Generate two independent values u1 and u2 from standard uniform distribution U(0, 1).

    3. Assume that a ln [U1/(1 – U1)], = α exp[V], U1U2 и qV – Y.

    4. If – QZ ≥ 0, Y is returned. Otherwise, go to the step 5.

    5. If ≥ ln Z, the value Y is returned. Otherwise, go to the step 2.

See also:

ISmGammaDistribution | Library of Methods and Models