Download Chapter 7 Discrete Probability Models

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Fisher–Yates shuffle wikipedia , lookup

Transcript
Chapter 7
Discrete Probability Models
7.1 Introduction
In the remaining chapters in Semester 1 we describe some standard probability models which
are often used with data from various sources, such as market research. However, before we
describe these models in detail, we need to establish some ground rules for counting events.
7.2 Permutations and Combinations
Suppose that we have three objects, labelled A, B and C, and we need to choose two of them.
This can be done in 6 possible ways:
A, B
A, C
B, A
B, C
C, A
C, B.
We say that the number of permutations of two objects out of three is 6. However, if we are
not interested in the ordering, just in whether A, B or C are chosen, then A, B is the same as
B, A, and so the number of selections is just 3:
A, B
A, C
B, C.
We say that the number of combinations of two objects out of three is 3.
When we have a small number of objects, like three, it is easy to count up the number of
permuations and combinations, but what if we had 20 objects? How many ways can we select
4 objects out of 20 objects, for example? Here it would take too long to write out all the possibilities (and we would probably make a mistake!).
Thinking back to the simple example where we just pick two out of three objects (A, B, C),
there are 3 possibilities for the first choice, and 2 possibilities for the second choice (as it can’t
be the same as the first). Therefore the number of possible permutations is
3 × 2 = 6.
Generalising this, if we had n objects and we want to choose r of them, then there are n possibilities for the first object, (n − 1) possibilities for the second object, as one has already been
74
CHAPTER 7. DISCRETE PROBABILITY MODELS
75
selected, (n − 2) possibilities for the third object, and so on until the rth object which has
n − r + 1 possibilities. Therefore the number of possible permutations is
n × (n − 1) × (n − 2) × · · · × (n − r + 1) =
n!
,
(n − r)!
where
n! = n × (n − 1) × (n − 2) × (n − 3) × · · · × 3 × 2 × 1
and is known as “n factorial” – it can be found on most calculators. So, for example, 3! =
3×2×1 = 6. In fact, the right-hand-side of the first equation above is a commonly encountered
expression in counting calculations and has its own notation. The number of ordered ways of
selecting r objects out of n is denoted n Pr , where
n
Pr =
n!
(n − r)!
and this can also be found on most calculators (sometimes it looks like nPr). We refer to n Pr
as the number of permutations of r objects out of n.
Thinking back to the simple example where we just pick two out of three objects, there were
6 possibilities, but then when the order didn’t matter the number of possibilities reduced to 3.
This was because we divided the 6 possibilities by the number of ways that we could order the
two objects, which in this case was 2 (for example, A,B is the same as B,A). In general the
number of ways of ordering r objects is
r × (r − 1) × · · · × 1 = r!
Therefore, in general, the number of combinations of r objects from n objects is
n!
Pr
=
.
r!
r!(n − r)!
n
n
Cr =
There are other commonly used notations for this quantity:
Cnr ,
n
and often nCr on calcur
lators. These numbers are known as the binomial coefficients.
Example 1
For example, a company has 20 retail outlets. It is decided to try a sales promotion at 4 of these
outlets. How many selections of 4 outlets can be chosen?
Solution
Now we can see that the number of ways to select 4 retail outlets out of 20 is
CHAPTER 7. DISCRETE PROBABILITY MODELS
76
Example 2
To see how combinations can be used to calculate probabilities, we will look at the UK National
Lottery example we touched on in last week’s lecture (Chapter 6). In this lottery, there are 49
numbered balls, and six of these are selected at random. A seventh ball is also selected, but this
is only relevant if you get exactly five numbers correct. The player selects six numbers before
the draw is made, and after the draw, counts how many numbers are in common with those
drawn. Players win a prize if they select at least three of the balls drawn. The order in which
the balls are drawn is irrelevant.
Let’s consider the probability of winning the jackpot (i.e. you correctly match all six balls).
How many ways can 6 balls be chosen out of 49? One option is {1, 2, 3, 4, 5, 6}; another is
{1, 2, 3, 4, 5, 7} . . . in fact, there are
49
C6 = 13, 983, 816
different ways 6 balls can be selected out of a possible 49. Now out of these 13,983,816 different
combinations, how many combinations match the drawn balls correctly? Only one! There is
only one set of six numbers that wins the jackpot! So the probability of winning the jackpot is
just one in 13,983,816, that is,
P (match exactly 6 correct numbers) =
# ways to match 6 balls
1
=
,
# ways to select 6 balls out of 49
13, 983, 816
or just over a one in fourteen million chance! The other probabilities used in Chapter 6 to
calculate the Expected Monetary Value for the lottery can be found using similar arguments.
7.3 Probability Distributions
7.3.1 Introduction
Before we can make inferences about populations, we need a language to describe the uncertainty we find when taking samples from populations. First, we represent a random variable by
X (capital X) and the probability that it takes a certain value x (small x) as P (X = x).
The probability distribution of a discrete random variable X is the list of all possible values
X can take and the probabilities associated with them. For example, if the random variable X
is the outcome of a roll of a six-sided dice then the probability distribution for X is:
k
P (X = k)
1
2
3
4
5
6 Sum
1/6 1/6 1/6 1/6 1/6 1/6
1
Note that the sum of all probabilities is equal to 1 for a discrete random variable.
CHAPTER 7. DISCRETE PROBABILITY MODELS
77
Example 3
Let X be the number of cars observed in half–hour periods passing the junction of two roads.
In a five hour period, the following observations on X were made:
2
3 2
5 5
3 4
5 6 7
Thus would give the following probability distribution:
k
P (X = k)
0
1
2
3
4
5
6
7
>7
Sum
spa spa spa spa spa spa spa spa spa spa
Does this make sense? Is it impossible to see, for example, 8 cars at this junction? Do we
know, with certainty, that we will never see 10 cars pass this junction, even in rush hour? Do
we know that we will never see fewer than two cars pass this junction, even at three o’clock in
the morning? We often need to make predictions based on the limited information provided by
a sample as small as this, but these predictions need to be sensible. This is one situation where
probability models are useful. In the next chapter, we consider two such models for discrete
data, however for now consider the following example.
7.3.2 Example
Suppose we are interested in the number of sixes we get from 3 rolls of a dice. Each roll of the
dice is an experiment or trial which gives a “six” (success, or s) or “not a six” (failure, or f ).
The probability of a success is p = P (six) = 1/6. We have n = 3 independent experiments
or trials (rolls of the dice). Let X be the number of sixes obtained. We can now obtain the full
probability distribution of X.
For example, suppose we want to work out the probability of obtaining three sixes (three “successes” — i.e. sss — or P (X = 3)). Since the rolls of the die can be considered independent,
we get:
3
1
1 1 1
P (sss) = P (s) × P (s) × P (s) = × × =
6 6 6
6
That one’s easy! What about the probability that we get two sixes — i.e. P (X = 2)? This one’s
a bit more tricky, because that means we need two s’s and one f — i.e. two sixes and one “not
six” — but the “not six” could appear on the first roll, or the second roll, or the third! Thinking
about it, there are actually eight possible outcomes for the three rolls of the die.
CHAPTER 7. DISCRETE PROBABILITY MODELS
78
s
s
1
6
5
6
f
s
( 61 )3
1
6
5
6
( 61 )2 ( 65 )
f
s
1
6
( 16 )2 ( 65 )
1
6
5
6
f
s
f
5
6
s
1
6
f
5
6
s
f
f
( 16 )( 56 )2
( 16 )2 ( 65 )
1
6
5
6
( 16 )( 56 )2
( 61 )( 56 )2
1
6
5
6
( 65 )3
So, for P (X = 2), we could have:
5 1 1
P (f ss) =
× × =
6 6 6
2
1
5
× ,
6
6
1 5 1
P (sf s) =
× × =
6 6 6
2
5
1
× ,
6
6
1 1 5
× × =
P (ssf ) =
6 6 6
2
5
1
× ,
6
6
or we could have:
or even:
Can you see that we therefore get:
2
5
1
× .
P (X = 2) = 3 ×
6
6
CHAPTER 7. DISCRETE PROBABILITY MODELS
79
Which takes the form:
P (X = 2) = Number of ways to get two sixes × P (2 sixes) × P (1 “not six”).
Using the same argument as above we can calculate the other probabilities:
3
5
= 0.579
P (X = 0) =
6
2
1
5
P (X = 1) = 3 ×
×
= 0.347
6
6
2
5
1
× = 0.069
P (X = 2) = 3 ×
6
6
3
1
= 0.005,
P (X = 3) =
6
and so the full probability distribution for X is:
r
0
1
2
3
P (X = r) 0.579 0.347 0.069 0.005
This probability distribution shows that most of the time we would get either 0 or 1 sixes and,
for example, 3 sixes would be quite rare. You might like to try rolling a die three times and
observing how many sixes you obtain. Repeating this a large number of times will give you
relative frequencies which should be close to these “theoretical” probabilities.
Now this is a bit long–winded . . . and that was just for three rolls of the dice! Imagine what it
would be like to calculate for 100 rolls of the dice!
We would like a more concise way of working out these probabilities without having to list
all the possible outcomes as we did above. And luckily, there’s a formula that does just that!
The formula takes the form:
P (X = r) = # ways to get r successes out of n trials × P (r successes) × P (n − r failures)
= n Cr × pr × (1 − p)n−r .
The expression for P (X = 2) in the die rolling example can be calculated using this formula.
In this example n = 3, r = 2, the probability of success (i.e. rolling a six) is p = 16 , therefore
the probability of failure (i.e. not rolling a six) is 1 − p = 56 . So,
3−2
2 1
1
3
P (X = 2) = C2 ×
× 1−
6
6
2
5
1
×
=3×
6
6
= 0.069.
which matches up exactly with what we calculated before (as it should)!
We will look at this formula in more detail in the next chapter.
CHAPTER 7. DISCRETE PROBABILITY MODELS
80
7.4 Exercises
1. A market survey has identified 10 desirable features for a new product. However, due to cost
constraints, only four of these features can be included. If the features are selected randomly,
what is the probability that your four favourites are chosen in your preferred ordering?
2. Consider a lottery that is the same as the UK National Lottery in every way, except that there
are 48 balls instead of 49. What is the probability of winning the jackpot in this lottery (i.e.
the probability of matching the six balls that are drawn)?
3. Consider the following probability distribution for the discrete random variable X. One of
the values is missing.
k
-2
P (X = k) 0.1
-1 0 1
2
0.2 ? 0.3 0.2
What is the missing value, P (X = 0)?
4. Let X be the number of sixes rolled on four rolls of a regular six-sided die.
(a) Calculate the probability distribution of X, i.e. the values P (X = r) for r = 0, 1, 2, 3, 4.
[Hint: you may find the example on pages 77-79 helpful.]
(b) What is the most likely number of sixes from four rolls of a dice?