Published by the Foundation for Open Access Statistics
Editors-in-chief: Bettina Grün, Torsten Hothorn, Edzer Pebesma, Achim Zeileis    ISSN 1548-7660; CODEN JSSOBK
The Monty Python Method for Generating Gamma Variables | Marsaglia | Journal of Statistical Software
Authors: George Marsaglia, Wai Wan Tsang
Title: The Monty Python Method for Generating Gamma Variables
Abstract: The Monty Python Method for generating random variables takes a decreasing density, cuts it into three pieces, then, using area-preserving transformations, folds it into a rectangle of area 1. A random point (x,y) from that rectangle is used to provide a variate from the given density, most of the time as itself or a linear function of x . The decreasing density is usually the right half of a symmetric density.

The Monty Python method has provided short and fast generators for normal, t and von Mises densities, requiring, on the average, from 1.5 to 1.8 uniform variables. In this article, we apply the method to non-symmetric densities, particularly the important gamma densities. We lose some of the speed and simplicity of the symmetric densities, but still get a method for γα variates that is simple and fast enough to provide beta variates in the form γa/(γab). We use an average of less than 1.7 uniform variates to produce a gamma variate whenever α ≥ 1 . Implementation is simpler and from three to five times as fast as a recent method reputed to be the best for changing α's.

Page views:: 8747. Submitted: 1998-05-22. Published: 1999-01-08.
Paper: The Monty Python Method for Generating Gamma Variables     Download PDF (Downloads: 9153)
DOI: 10.18637/jss.v003.i03

This work is licensed under the licenses
Paper: Creative Commons Attribution 3.0 Unported License
Code: GNU General Public License (at least one of version 2 or version 3) or a GPL-compatible license.