An Easily Programmed Algorithm for Generating Gamma Random Variables

Anthony C. Atkinson · Journal of the Royal Statistical Society Series A (General) · 1977

THIS note describes an easily programmed algorithm for generating gamma random variables with index ax greater than one which is intended to be complementary to the algorithms GO of Ahrens and Dieter (1974) and GB of Cheng (1977). Although the efficiency of these two published algorithms is high when ac is large, for values of ac near one the algorithms are respectively non-existent and inefficient. The new algorithm has been designed to be efficient in this region and is recommended for use in the range 1 1. The disadvantages of this method are that it is complicated to program and requires time equal to that required for the generation of several hundred random variables to calculate the values of a set of constants which depend on ox. Of the more compact algorithms compared by Atkinson and Pearce the fastest is the algorithm GO of Ahrens and Dieter, a rejection method with first stage sampling from either a normal or an exponential distribution. The method is not applicable for ax 1, in which first stage sampling in the rejection method is from a log logistic distribution. An improved version of this algorithm, GB, is given in Cheng (1977) where the concavity of logx is used to provide an easily calculated preliminary test of acceptance. In this form Cheng's algorithm is comparable in performance with Ahrens and Dieter's GO for ox> 2 53. Our algorithm, which is based on a composition/rejection method in which the range of x is broken into two parts at the mode t = cx1, is described in the next section and compared with the algorithms of Ahrens and Dieter, Cheng and Fishman.

Read the paper · More papers on PaperTik