Inverse transform sampling

This is an old revision of this page, as edited by AlekseyP (talk | contribs) at 02:31, 11 May 2006 (interwiki). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The inverse transform sampling method is a method of sampling a number at random from any probability distribution given its cumulative distribution function (cdf).

The method

The problem that the inverse transform sampling method solves is as follows:

  • Let X be a random variable whose distribution can be described by the cdf F.
  • We want to generate values of X which are distributed according to this distribution.

Many programming languages have the ability to generate pseudo-random numbers which are effectively distributed according to the standard uniform distribution. If a random variable has that distribution, then the probability of its falling within any subinterval (a, b) of the interval from 0 to 1 is just the length ba of that subinterval.

The inverse transform sampling method works as follows:

  1. Generate a random number from the standard uniform distribution; call this u.
  2. Compute the value x such that  ; call this xchosen.
  3. Take xchosen to be the random number drawn from the distribution described by F.

Proof of correctness

Let F be a continuous cumulative distribution function, and let   be its inverse function:[1]

 

Claim: If U is a uniform random variable on   then   follows the distribution F.

Proof:

 
     (by the definition of  )
     (applying F, which is monotonic, to both sides)
     (because  , since U is uniform on the unit interval)

References

  1. ^ Luc Devroye. Non-Uniform Random Variate Generation. New York: Springer-Verlag, 1986. (online) See chapter 2, section 2, p. 28.