For a model (1) I needed to calculate the cumulative distribution function F(x) of the Gamma distribution. There is no uniform consensus: the Gamma distribution has different parametrizations. I use the k,θ parametrization from (2). This would yield (3):
F(x)=γ(xθ,k) |
where γ(x,a) is the incomplete Gamma function defined by:
γ(x,a)=1Γ(a)∫x0ta−1e−tdt |
The function Γ(x) is the (complete) Gamma function:
Γ(x)=∫∞0tx−1e−tdt |
Unfortunately there a few alternative definitions of the incomplete Gamma function. In (2) the following definition is used:
γ(s,x)=∫x0ts−1e−tdt |
So watch out: different definitions are being used.
As a result we can implement the CDF of the Gamma distribution with parameter k and θ as follows (2):
GammaReg(x/theta,k)
There is also a more obscure way to calculate this using an extrinsic function. The syntax is unfortunately needlessly complicated and the documentation is really, really bad (4).
scalars |
References
- Modeling Flood Damages, http://yetanothermathprogrammingconsultant.blogspot.com/2017/07/modeling-flood-damages.html
- Gamma Distribution, https://en.wikipedia.org/wiki/Gamma_distribution
- New Special Functions in GAMS, http://www.amsterdamoptimization.com/pdf/specfun.pdf
- Stochastic Library, https://www.gams.com/latest/docs/userguides/userguide/_u_g__extrinsic_functions.html#UG_ExtrinsicFunctions_StochasticLibrary