Suppose I have a geometric distribution given which looks like this
p = 0.4 and
x is from
0 to inf. Now what does it mean when one says generate a random number/variable using this distribution?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.Sign up to join this community
In general, generating a random number from a probability distribution means transforming random numbers so that the numbers fit the distribution.
Perhaps the most generic way to do so is called inverse transform sampling:
However, this technique can't be used in practice for all distributions. The main reason is that the quantile function is either unavailable or hard to calculate. Thus, for many distributions, other techniques are used. They include rejection sampling, direct transformations, etc.
In the case of the geometric distribution, there are at least two ways to generate numbers that follow it. One way is a direct transformation:
A geometric random number can also be found by inverse transform sampling, described below.
Other ways to generate geometric random numbers are available. The choice of algorithm depends on many things, including efficiency, simplicity, and accuracy. (Note that the geometric distribution is defined differently in different works.) The same applies to other probability distributions.