Summary

Random numbers are widely used in statistics. For example, in generation of random samples and sampling from finite population. It is a computational device designed to generate a sequence of random numbers or symbols that lack any pattern. The many application of randomness have lead to the development of several different methods for generating random data. We have provided the syntax to generate random numbers from various discrete distributions using standard uniform distibution. Also, examples are provided to illustrate the syntax.


Uniform Distribution

 [1] 0.02774016 0.35148261 0.64503169 0.08251357 0.28122216 0.90209830
 [7] 0.41191685 0.85152406 0.18127632 0.23471648

Bernouli Disitribution

if \(U\) \(\sim\) \(U(0,1)\) and \(p\) is specified
\[\begin{equation*} \text{Define}\ \ X = \begin{cases} 1 & \text{if }\ U \leq p \\ 0 & \text{otherwise} \end{cases} \end{equation*}\]
Then \(X\) \(\sim\) \(B(1, p)\) distribution

.

Binomial Disitribution

if \(U_i\) \(\sim\) \(U(0,1)\), \(\forall\) \(i\) \(=\) 1, 2, …, \(n\) and \(n\) and \(p\) are specified
\[\begin{equation*} \text{Define}\ \ X_i = \begin{cases} 1 & \text{if }\ U_i \leq p \\ 0 & \text{otherwise} \end{cases};\ X_i\ \text{are independent} \end{equation*}\]
Then \(Y\) \(=\) \(\sum_{i=1}^{n} X_i\) \(\sim\) \(B(n, p)\) distribution

.

Poisson Distribution

Let \(U_i\) \(\sim\) \(U(0,1)\), \(\forall\) \(i\) \(=\) 1, 2, …, \(n\) and \(U_i\) are independent and identically distributed and \(\lambda\) specified
\[\begin{equation*} \text{Define}\ \ X = \displaystyle \min_{n \geq 0}\left[\prod_{i = 1}^{n+1}U_i\leq e^{-\lambda}\right] \end{equation*}\]
Then \(X\) \(\sim\) \(P(\lambda)\) distribution

.

Geometric Distribution

if \(U\) \(\sim\) \(U(0,1)\) then
\[\begin{equation*} X = \text{integer}\left[\frac{log(U)}{log(1-p)}\right] \end{equation*}\]
\(X\) \(\sim\) \(G(p)\) distribution

.

Negative Binomial Distribution

Let \(U_i\) \(\sim\) \(U(0,1)\), \(\forall\) \(i\) \(=\) 1, 2, …, \(n\) and \(U_i\) are independent and identically distributed and \(k\), \(p\) are specified
\[\begin{equation*} \text{Define}\ \ X_i = \text{integer}\left[\frac{log(U)}{log(1-p)}\right]; \ X_i\ \text{are independent} \end{equation*}\]
Then \(Y\) \(=\) \(\sum_{i=1}^{k} X_i\) \(\sim\) \(NB(k, p)\) distribution

.

Hypergeometric Distribution

Let \(U_i\) \(\sim\) \(U(0,1)\), \(\forall\) \(i\) \(=\) 1, 2, …, \(n\) and \(U_i\) are independent and identically distributed and \(M\), \(N\), and \(n\) are specified
\[\begin{equation*} \text{Define}\ \ X_i = \begin{cases} 1 & \text{if }\ U_i \leq \frac{N-\sum X}{N-(\sum X-1)} \\ 0 & \text{otherwise} \end{cases} \end{equation*}\]
Then \(X\) \(\sim\) \(HG(N, M, n)\) distribution

.

Example
  • Three random numbers from \(H(10, 5, 3)\) distribution
[1] 1 2 2

AUTHOR BIOGRAPHIES

Mr. Dadasaheb G. Godase is a PhD scholar in the Department of Statistics at Shivaji University, Kolhapur, India. Presently, he is working as an INSPIRE fellow of Department of Science and Technology, New Delhi, India in the Department of Statistics, Shivaji University, Kolhapur.

Mr. Shubham R. Shinde is a PG student in the Department of Statistics at Shivaji University, Kolhapur, India.