Non-uniform random variate generation

From Wikipedia, the free encyclopedia
(Redirected from Random number sampling)
Jump to navigation Jump to search

Non-uniform random variate generation or pseudo-random number sampling is the numerical practice of generating pseudo-random numbers (PRN) that follow a given probability distribution. Methods are typically based on the availability of a uniformly distributed PRN generator. Computational algorithms are then used to manipulate a single random variate, X, or often several such variates, into a new random variate Y such that these values have the required distribution. The first methods were developed for Monte-Carlo simulations in the Manhattan Project,[citation needed] published by John von Neumann in the early 1950s.[1]

Finite discrete distributions

[edit | edit source]

For a discrete probability distribution with a finite number n of indices at which the probability mass function f takes non-zero values, the basic sampling algorithm is straightforward. The interval [0, 1) is divided in n intervals [0, f(1)), [f(1), f(1) + f(2)), ... The width of interval i equals the probability f(i). One draws a uniformly distributed pseudo-random number X, and searches for the index i of the corresponding interval. The so determined i will have the distribution f(i).

Formalizing this idea becomes easier by using the cumulative distribution function

F(i)=j=1if(j).

It is convenient to set F(0) = 0. The n intervals are then simply [F(0), F(1)), [F(1), F(2)), ..., [F(n − 1), F(n)). The main computational task is then to determine i for which F(i − 1) ≤ X < F(i).

This can be done by different algorithms:

Continuous distributions

[edit | edit source]

Generic methods for generating independent samples:

Generic methods for generating correlated samples (often necessary for unusually-shaped or high-dimensional distributions):

For generating a normal distribution:

For generating a Poisson distribution:

Software libraries

[edit | edit source]
Random distributions provided by software libraries
Library Beta Binomial Cauchy Chi-squared Dirichlet Exponential F Gamma Geometric Gumbel Hypergeometric Laplace Logistic Log-normal Logarithmic Multinomial Multivariate hypergeometric Multivariate normal Negative binomial Noncentral chi-squared Noncentral F Normal Pareto Poisson Power Rayleigh Students's t Triangular von Mises Wald Zeta
NumPy Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
GNU Scientific Library[5] Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No Yes Yes Yes ? Yes Yes No No No No

See also

[edit | edit source]

Footnotes

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). Also online is a low-quality scan of the original publication.
  2. ^ Ripley (1987) [page needed]
  3. ^ Fishman (1996) [page needed]
  4. ^ Fishman (1996) [page needed]
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).

Literature

[edit | edit source]