Function Gamma(Shape, Lowerbound, Scale)

Gamma

The function Gamma draws a random value from a gamma distribution.

Gamma(
     Shape,        ! (input) numerical expression
     Lowerbound,   ! (optional) numerical expression
     Scale         ! (optional) numerical expression
     )

Arguments

Shape

A scalar numerical expression \(> 0\).

Lowerbound

A scalar numerical expression \(>= 0\).

Scale

A scalar numerical expression \(> 0\).

Return Value

The function Gamma returns a random value drawn from a gamma distribution with shape Shape, lower bound Lowerbound and scale Scale.

Note

The prototype of this function has changed with the introduction of AIMMS 3.4. In order to run models that still use the original prototype, the option Distribution_compatibility should be set to Aimms_3_0. The original function Gamma(alpha, Shape) returns a random value drawn from a gamma distribution with rate \(alpha = 1/Scale\), shape Shape and lower bound \(0\).

Graph

../../_images/gamma.png

A graph with:

  • a histogram for 1.000.000 experiments of drawing from distribution Gamma(3,0,2), and

  • the DistributionDensity for Gamma(3,0,2)

Example

The code:

option seed := 1234 ;
_p_draw := Gamma( 3, 0, 2 )  ;
_p_pointDensity := DistributionDensity( Gamma( 3, 0, 2 ), 9 );

block where listing_number_precision := 6 ;
        display _p_draw, _p_pointDensity ;
endblock ;

will produce

_p_draw := 11.206294 ;
_p_pointDensity := 0.056239 ;

in the listing file.

References