Math 362 - Computer Lab #3 - Fall 2002
Introduction
to Probability Theory
Computer Lab 3: The Binomial Random Variable
In this lab, we will first use the computer to both estimate and calculate the
probability mass function of a binomial random variable. We will then plot its
distribution function and solve some word problems.
- The binomial random variable
Consider a binomial random variable with n = 5 and p = 0.75.
- Simulating Bernoulli trials
- We will simulate a Bernoulli trial by asking the computer to choose a
number at random from the following list: 1, 1, 1, 0. Note that the probability
of obtaining a 1, which we will call success, is p = 0.75. To do so,
follow the steps below.
- Enter the above list in Column C1.
- Use Random Data -> Sample From
Columns... in the Calc menu. Enter the number of samples you want to
create (i.e. the number of Bernoulli trials you want to perform), indicate you are
sampling from Column C1 and that you want to store the results in Column C2.
Make sure the Sample with replacement box is checked.
- Use the Stat -> Tables -> Tally... to check that the
percentage of 1's obtained is reasonable. Increase the number of trials
if necessary.
- Repeat the experiment with a different list (e.g. with 2 0's and 6
1's) to convince yourself that the results are consistent.
- Simulating a binomial random variable
- Create 5 (i.e. the value of the parameter n of the binomial random
variable) columns of samples from Column C1.
- We will consider that each row of 5 numbers represents 5 consecutive Bernoulli
trials. Calculate the value of X, the binomial random variable with n
= 5 and p = 0.75, for each of these sets of trials.
- Use Stat -> Tables -> Tally... or Stat
-> Basic Statistics -> Store Descriptive Statistics... to estimate
the probability of each event of the form X = xk.
- Use the Graph menu to produce a plot of these probabilities as functions
of each possible value of X. Such a plot gives you an approximation of the
probability mass function (p.m.f.) of X.
- The distribution of X
The computer can calculate probabilities Pr (X = xk),
where X is a binomial random variable. We will use this feature obtain exact
values for the p.m.f. of X with n = 5 and p = 0.75.
- Enter all possible values that X can take in say Column C8.
- Use Calc -> Probability Distributions -> Binomial to
calculate the exact probabilities.
- Choose to calculate a Probability
- Enter 5 as the Number of trials and 0.75 as the Probability
of success.
- Use Column C8 as the Input column and enter the column where you
want the probabilities to be written in the Optional strorage field.
- Then click OK
- Plot the exact probability mass function of X and compare the result
with the approximate graph you had before.
- The (cumulative) distribution function (c.d.f.) F of X
is defined by
- F(x) = Pr (X ≤ x)
Use the plot of the probability mass function of X to draw the graph of F
below
- Check your answer by using the computer to plot a graph of F. You can
calculate probabilities of the form Pr (X ≤ x) by using Calc
-> Probability Distributions -> Binomial and choosing the
Cumulative Probability option.
- Word Problems
From A First Course in Probability by Sheldon Ross, Prentice Hall, 2002.
- A communication channel transmits the digits 0 and 1. However, due to static,
the digit transmitted is incorrectly received with probability 0.2. Suppose that we
want to transmit an important message consisting of one binary digit. To reduce the
chance of error, we transmit 00000 instead of 0 and 11111 instead of 1. If the receiver
of the message uses majority decoding, what is the probability that the
message will be wrong when decoded? What independence assumption are you making?
- A student is getting ready to take an important oral examination and is
concerned about the possibility of having an on day or an
off day. He figures that if he has an on day, then each of his examiners
will pass him independently of each other, with probability 0.8, whereas, if he has
an off day, this probability will be reduced to 0.4. Suppose that the student will
pass the examination if a majority of the examiners pass him. If the student feels that
he is twice as likely to have an off day as he is to have an on day, should he request
an examination with 3 examiners or with 5 examiners?
The macro Binomial.MTB simulates 10000 experiments, each
consisting of 5 Bernoulli trials with p = 0.75. It then uses the results to
estimate the p.m.f. of the corresponding binomial random variable, and compares the
approximated probabilities to the exact ones. It also plots the c.d.f. of a binomial
random variable with n = 5 and p = 0.75. This macro assumes that the list
0, 1, 1, 1 has been entered in Column C1. You may try
and modify this file at your convenience.
Back to Math 362