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!
cited_by
cites
container_end_page 8
container_issue 1
container_start_page 1
container_title Journal of statistical software
container_volume 3
creator George Marsaglia
Wai Wan Tsang
description 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.
doi_str_mv 10.18637/jss.v003.i03
format article
fullrecord <record><control><sourceid>doaj</sourceid><recordid>TN_cdi_doaj_primary_oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f1</recordid><sourceformat>XML</sourceformat><sourcesystem>PC</sourcesystem><doaj_id>oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f1</doaj_id><sourcerecordid>oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f1</sourcerecordid><originalsourceid>FETCH-doaj_primary_oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f13</originalsourceid><addsrcrecordid>eNqtjrsKwjAUQIMg-Bzd8wPWm9421Vl8DYKDuIYbTduUtpGkCP17RfwEpwNnOBzGFgIisZaYraoQohcARhZwwMYiTdbLTEoYsUkIFUAMySYdM3ktDT-7tuv5pe9K1_Kz-eDBc-f5wbTGU2fbgh-oaYjfyFvStQkzNsypDmb-45Sd9rvr9rh8OKrU09uGfK8cWfUVzheKfGfvtVGIBknHWqf4eUKhU0AhN7mGWCdZLvCfrTePl1LN</addsrcrecordid><sourcetype>Open Website</sourcetype><iscdi>true</iscdi><recordtype>article</recordtype></control><display><type>article</type><title>The Monty Python Method for Generating Gamma Variables</title><source>DOAJ Directory of Open Access Journals</source><creator>George Marsaglia ; Wai Wan Tsang</creator><creatorcontrib>George Marsaglia ; Wai Wan Tsang</creatorcontrib><description>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.</description><identifier>EISSN: 1548-7660</identifier><identifier>DOI: 10.18637/jss.v003.i03</identifier><language>eng</language><publisher>Foundation for Open Access Statistics</publisher><ispartof>Journal of statistical software, 1999-01, Vol.3 (1), p.1-8</ispartof><lds50>peer_reviewed</lds50><oa>free_for_read</oa><woscitedreferencessubscribed>false</woscitedreferencessubscribed></display><links><openurl>$$Topenurl_article</openurl><openurlfulltext>$$Topenurlfull_article</openurlfulltext><thumbnail>$$Tsyndetics_thumb_exl</thumbnail><link.rule.ids>314,780,784,864,2102,27924,27925</link.rule.ids></links><search><creatorcontrib>George Marsaglia</creatorcontrib><creatorcontrib>Wai Wan Tsang</creatorcontrib><title>The Monty Python Method for Generating Gamma Variables</title><title>Journal of statistical software</title><description>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.</description><issn>1548-7660</issn><fulltext>true</fulltext><rsrctype>article</rsrctype><creationdate>1999</creationdate><recordtype>article</recordtype><sourceid>DOA</sourceid><recordid>eNqtjrsKwjAUQIMg-Bzd8wPWm9421Vl8DYKDuIYbTduUtpGkCP17RfwEpwNnOBzGFgIisZaYraoQohcARhZwwMYiTdbLTEoYsUkIFUAMySYdM3ktDT-7tuv5pe9K1_Kz-eDBc-f5wbTGU2fbgh-oaYjfyFvStQkzNsypDmb-45Sd9rvr9rh8OKrU09uGfK8cWfUVzheKfGfvtVGIBknHWqf4eUKhU0AhN7mGWCdZLvCfrTePl1LN</recordid><startdate>19990101</startdate><enddate>19990101</enddate><creator>George Marsaglia</creator><creator>Wai Wan Tsang</creator><general>Foundation for Open Access Statistics</general><scope>DOA</scope></search><sort><creationdate>19990101</creationdate><title>The Monty Python Method for Generating Gamma Variables</title><author>George Marsaglia ; Wai Wan Tsang</author></sort><facets><frbrtype>5</frbrtype><frbrgroupid>cdi_FETCH-doaj_primary_oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f13</frbrgroupid><rsrctype>articles</rsrctype><prefilter>articles</prefilter><language>eng</language><creationdate>1999</creationdate><toplevel>peer_reviewed</toplevel><toplevel>online_resources</toplevel><creatorcontrib>George Marsaglia</creatorcontrib><creatorcontrib>Wai Wan Tsang</creatorcontrib><collection>DOAJ Directory of Open Access Journals</collection><jtitle>Journal of statistical software</jtitle></facets><delivery><delcategory>Remote Search Resource</delcategory><fulltext>fulltext</fulltext></delivery><addata><au>George Marsaglia</au><au>Wai Wan Tsang</au><format>journal</format><genre>article</genre><ristype>JOUR</ristype><atitle>The Monty Python Method for Generating Gamma Variables</atitle><jtitle>Journal of statistical software</jtitle><date>1999-01-01</date><risdate>1999</risdate><volume>3</volume><issue>1</issue><spage>1</spage><epage>8</epage><pages>1-8</pages><eissn>1548-7660</eissn><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/(γ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.</abstract><pub>Foundation for Open Access Statistics</pub><doi>10.18637/jss.v003.i03</doi><oa>free_for_read</oa></addata></record>
fulltext fulltext
identifier EISSN: 1548-7660
ispartof Journal of statistical software, 1999-01, Vol.3 (1), p.1-8
issn 1548-7660
language eng
recordid cdi_doaj_primary_oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f1
source DOAJ Directory of Open Access Journals
title The Monty Python Method for Generating Gamma Variables
url http://sfxeu10.hosted.exlibrisgroup.com/loughborough?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2024-12-24T13%3A33%3A36IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-doaj&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=The%20Monty%20Python%20Method%20for%20Generating%20Gamma%20Variables&rft.jtitle=Journal%20of%20statistical%20software&rft.au=George%20Marsaglia&rft.date=1999-01-01&rft.volume=3&rft.issue=1&rft.spage=1&rft.epage=8&rft.pages=1-8&rft.eissn=1548-7660&rft_id=info:doi/10.18637/jss.v003.i03&rft_dat=%3Cdoaj%3Eoai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f1%3C/doaj%3E%3Cgrp_id%3Ecdi_FETCH-doaj_primary_oai_doaj_org_article_33e3ab2bb5354831b503169fb02b47f13%3C/grp_id%3E%3Coa%3E%3C/oa%3E%3Curl%3E%3C/url%3E&rft_id=info:oai/&rft_id=info:pmid/&rfr_iscdi=true