Loading…

The Monty Python Method for Generating Gamma Variables

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 t...

Full description

Saved in:
Bibliographic Details
Published in:Journal of statistical software 1999-01, Vol.3 (1), p.1-8
Main Authors: George Marsaglia, Wai Wan Tsang
Format: Article
Language:English
Online Access:Get full text
Tags: Add Tag
No Tags, Be the first to tag this record!
Description
Summary: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/(γa+γb). 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.
ISSN:1548-7660
DOI:10.18637/jss.v003.i03