Special Distribution

Gamma distribution

Firstly, let's introduce how to generate Ga(a,β){\mathcal G}a(a,\beta) where aa 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(α,β){\mathcal G}a(\alpha,\beta), we can use Ga(a,b){G}a(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\beta=1, we can do some further calculations,

and would get more simpler expression,

Last updated