Gamma Distribution - Generating Gamma-distributed Random Variables

Generating Gamma-distributed Random Variables

Given the scaling property above, it is enough to generate gamma variables with as we can later convert to any value of with simple division.

Using the fact that a distribution is the same as an distribution, and noting the method of generating exponential variables, we conclude that if is uniformly distributed on, then − is distributed Now, using the "α-addition" property of gamma distribution, we expand this result:

where are all uniformly distributed on and independent. All that is left now is to generate a variable distributed as for and apply the "α-addition" property once more. This is the most difficult part.

Random generation of gamma variates is discussed in detail by Devroye, noting that none are uniformly fast for all shape parameters. For small values of the shape parameter, the algorithms are often not valid. For arbitrary values of the shape parameter, one can apply the Ahrens and Dieter modified acceptance-rejection method Algorithm GD (shape k ≥ 1), or transformation method when 0 < k < 1. Also see Cheng and Feast Algorithm GKM 3 or Marsaglia's squeeze method.

The following is a version of the Ahrens-Dieter acceptance-rejection method:

  1. Let be 1.
  2. Generate, and as independent uniformly distributed on variables.
  3. If, where, then go to step 4, else go to step 5.
  4. Let . Go to step 6.
  5. Let .
  6. If, then increment and go to step 2.
  7. Assume to be the realization of .

A summary of this is

where

  • is the integral part of ,
  • has been generated using the algorithm above with (the fractional part of ),
  • and are distributed as explained above and are all independent.

Read more about this topic:  Gamma Distribution

Famous quotes containing the words random and/or variables:

    We should stop looking to law to provide the final answer.... Law cannot save us from ourselves.... We have to go out and try to accomplish our goals and resolve disagreements by doing what we think is right. That energy and resourcefulness, not millions of legal cubicles, is what was great about America. Let judgment and personal conviction be important again.
    Philip K. Howard, U.S. lawyer. The Death of Common Sense: How Law Is Suffocating America, pp. 186-87, Random House (1994)

    The variables of quantification, ‘something,’ ‘nothing,’ ‘everything,’ range over our whole ontology, whatever it may be; and we are convicted of a particular ontological presupposition if, and only if, the alleged presuppositum has to be reckoned among the entities over which our variables range in order to render one of our affirmations true.
    Willard Van Orman Quine (b. 1908)