Special Distribution
Gamma distribution
Firstly, let's introduce how to generate Ga(a,β) where a is an integral (Robert and Casella (2013)).

Attention! The parameter in (2.2.1) is scale parameter, thus the code to sample is
Then when considering the general Ga(α,β), we can use Ga(a,b) as instrumental distribution in Accept-Rejection algorithm as mentioned in Robert and Casella (2013):

where func_gamma.jl is to calculate gamma function via Lanczos Approximation because there is not gamma function in Julia.
If β=1, we can do some further calculations,

and would get more simpler expression,

Last updated