Random Number generation-

From Bernoulli distribution

Random number can be generated from many statistical distributions, here let's talk about how to generate random numbers from Bernoulli distribution first.
A trial or an experiment, whose outcome can be classified as either a success or a failure, is performed. If we let X=1 when the outcome is a success and X=0 when it's a failure, then the probability mass function is given by the following equation:

p(0)=P{X=0}=1-p

p(1)=P{X=1}=p (0<p<1)

A random variable which follows this equation is said to be a Bernoulli random variable. For instance, the outcome of flipping a fair coin follows Bernoulli distribution, with the probability of getting a head (tail) is 0.5. If we want to know the outcome of 100 coin toss, Minitab can save us time to generate the outcome in a second.

Select Calc->Random data->Bernoulli from the menu, fill out the dialog as shown below, then we get 3 100-row columns outcomes of flipping a coin.


With command shown as below we can have same result:

MTB>random 100 c1-c3;

SUBC>Bernoulli .5.

The Tally command produces and print tables for each column. With Tally command we can see if flipping a coin 100 times is enough to show the "long run regularity" which is the probability of getting a head is 0.5.

Select Stat->Tables->Tally from the menu, fill out the dialog show as below, click OK, we now get the summary of percentages of each value in one column. In this case, we find out that flipping a coin 100 times is quite enough to get he probability of having a head is 0.5.


Same result can be obtained by using the following command:

STB>tally c1-c3;

SUBC>percents.

Go back to index.