Transcript week7

Combinations and Permutations
• The number of ways to arrange k items in a row is given by k! .
• Example:
The number of ways to arrange 5 soldiers in a row is:
5! = 1·2·3·4·5.
• The number of ways to choose k items out of n without
replacement is given by
n
n!
  
 k  k!n  k !
• Example: The number of ways to select 3 soldier from a group
of 5 is: 5!/(3!·2!) = 10.
• This is also known as the binomial coefficient.
week7
1
Discrete Random Variables
• A random variable (r.v.) assigns a numerical value to the
outcomes in the sample space of a random phenomenon.
• A discrete r.v X has a finite number of possible values. The
probability distribution of X lists the values xi and their
probabilities pi. Every pi is a number between 0 and 1. The sum
of the pi’s must equal 1.
• Examples
1. Consider the experiment of tossing a coin. Define a random
variable as follows: X = 1 if a H comes up
= 0 if a T comes up.
This is an example of a Bernoulli r.v. The Probability function
of X is given in the following table
x
P(X = x)
week7
1
0
p
1- p
2
2.
3.
4.
Let X be a r.v counting the number of girls in a family with 3
children.
The probability function of X is given in the following table.
x
P(X = x)
0
1
2
3
(0.5)3 = 0.125
3·(0.5)3 = 0.375
3·(0.5)3 = 0.375
(0.5)3 = 0.125
Toss a coin 4 times. Let X be the number of H’s. Find the
probability function of X. Draw a probability histogram.
Toss a coin until the 1st H. Let X be the number of T’s before
the 1st H. Find the probability function of X.
week7
3
Mean (expected value) of a discrete r. v.
• The mean of a r. v. X is denoted by μx and can be found using
the following formula:
 X   x  P X  x    xi  pi
x
i
• Examples:
1. The mean of the Bernoulli r.v defined in example 1 above is :
μx= 0·(1-p) + 1·p = p
2. The mean number of girls in a family with 3 children is 1.5.
• Exercise: Find the mean of X in example 3 above.
• Exercise: Read Example 4.20 on p291 in IPS.
week7
4
Example – Discrete Uniform r.v
• Roll a six-sided die. Define a r. v. X to be the number shown on
the die. That is, X = 1 if die lands on 1,
X = 2 if die lands on 2, etc.
The probability distribution of X is given in the table below:
x
P(X = x)
1
2
3
4
5
6
1/6
1/6
1/6
1/6
1/6
1/6
The mean of X is
μX = 1·(1/6) + 2·(1/6) + 3·(1/6) + 4·(1/6) +5·(1/6) + 6·(1/6) = 21/6 = 3.5 .
week7
5
Law of large numbers
• If independent observations are drawn from a population with
a finite mean , the population mean  can be estimated with
a specified degree of accuracy by the sample mean x , using
sufficiently large sample.
week7
6
Rules for Mean of r.v
•
1.
2.
3.
4.
For any two r.v’s X and Y and constants a and b,
μ x + a = μx + a .
μ b·x = b·μx .
μ b·x + a = b·μx + a .
μ X + Y = μX + μY.
•
Example:
The price X of Nike sports shoes is a random variable with mean μx = 200$.
Before the holidays Nike company had a promotion: “ Pay 10$ less for each
item and get 20% discount from the original price”.
a)
What is the mean price during the promotion.
b)
Suppose in addition that during the promotion the mean price for Nike
socks is μY = 20$. What is the expected value of your expenses if you are
to buy one pair of shoes and one pair of socks ?
week7
7
The variance of a r. v.
•
•
The variance of a r. v. is an average of the squared deviations
from the mean, (X – μx)2 .
The Variance of a discrete r. v. is
   x   X 
2
2
X
x


2
2
 P X  x    x  P X  x    X 
 x

•
The standard deviation σX of a r. v. is the square root of its
variance.
• Examples:
1. The variance of a Bernoulli r.v is
σ2x = p – p2 = p(1- p)
2. The variance of the Uniform example above is
σ2x = (91/6) – (3.5)2 = 2.9167
week7
8
Rules for variances
• If X is a r. v. and a and b are constants, then
1.  X2  a   X2
2
2
2
2.  bX  b   X
2
2
2


b


3. bX  a
X
4. If X and Y are independent r. v’s then,
 X2 Y   X2   Y2
 X2 Y   X2   Y2
week7
9
•
If X and Y are not independent,
 X2 Y   X2   Y2  2 X  Y
 X2 Y   X2   Y2  2 X  Y
where ρ is the correlation between X and Y.
•
Two random variables X and Y are independent if knowing
that any event involving X alone did or did not occur tells us
nothing about the occurrence of any event involving Y alone.
•
Example:
Consider again the Nike example above. If the stdev. of X is
σx = 10$ and the stdev. of Y is σY = 8$.
a) What is the stdev. of the shoes price during the promotion? (8).
b) What is the stdev. of your expenses if you were to buy one pair
of shoes and one pair of socks ? (12.806).
•
Example 4.26 on page 302 in IPS.
week7
10
The binomial distribution
• The binomial setting:
 There is a fixed number, n, of observations.
 The n observations are independent.
 Each observation falls into one of just two categories
(“success” and “failures”).
 The probability of a success (call it p) is the same for each
observation.
 The binomial r.v, X counts the number of successes in n
trials.
Notation: X ~ Bin(n,p).
• Example:
A biased coin (P(H) = p = 0.6) ) is tossed 5 times. Let X be the
number of H’s. Find P(X = 2). This X is a binomial r. v.
week7
11
Probability function of the binomial dist.
• If X has a Bin(n, p) distribution, the probability function of X is
given by
n x
n x
for x = 0,1,2,…,n
P X  x     p 1  p 
 x
• The Mean and Variance of X are,
μX = n·p , and σX = n·p·(1-p)
• Example: The mean number of H’s in the example above is
μX = 5·0.6 = 3 , and the variance is σ2X = 5·0.6·0.4 = 1.2
week7
12
Sampling distribution of a count
• When the population is much larger than the sample (at least
20 times larger), the count X of successes in a SRS of size n
has approximately the Bin(n, p) distribution where p is the
population proportion of successes.
• Example 5.3 on p337 in IPS.
week7
13
Example
You are planning a sample survey of small businesses in your
area. You will choose a SRS of businesses listed in the
telephone book's Yellow Pages. Experience shows that only
about half the businesses you contact will respond.
(a) If you contact 150 businesses, it is reasonable to use the
Bin(150, 0.5) distribution for the number of businesses X
who respond. Explain why.
(b) What is the expected number (the mean) of businesses who
will respond and what is its std dev.?
week7
14
Exercise
• The probability that a certain machine will produce a defective
item is 1/4. If a random sample of 6 items is taken from the
output of this machine, what is the probability that there will
be 5 or more defectives in the sample? What is the expected
value of defective items in a sample of size 12.
week7
15
Sample Proportions
• The sample proportion of successes, denoted by p̂ , is
X
pˆ 
n
• Mean and standard deviation of the sample proportion of
successes in a SRS of size n are
p1  p 
 pˆ  p
 pˆ 
n
• Example 5.8 on page 342 in IPS.
week7
16
Question 1 Summer 2000, QIII b
• Suppose that the ‘true’ odds are 6 to 4 that team A will win an
upcoming Stanley Cup playoff series (so that probability of A
winning is 0.6). You place a bet in the amount of $100 on team
A, The payoff you will receive if team A wins is $160. What is
your expected net gain using the quoted odds above.
• If the casino accepts 1000 bets just like yours, what is the
expected income for the casino and the standard dev. of this
income.
week7
17
Question 1 Summer 2000, Q D
• While in the casino in your hotel, you try the “double till I
win” strategy for betting. Assume that the chances are 0.5 that
you win or lose every time you play some casino game. You
bet $10 to start. If you win, you quit. If you lose, you double
your bet to $20. If you win, you quit. If you lose, you double
your bet. You quit the moment you win a game, or you will
quit when you lose 5 consecutive times. Write down all
possible outcomes for your evening and their probabilities.
Workout your net gain for each outcome above.
What is your expected net gain.
week7
18
Exercise
A golf ball manufacturer is considering whether or not he
should change to a new production process. Eight percent of
the balls produced by the old process are defective and cannot
be sold while in the new process it is only five percent. But the
cost of production in the new process is 90 cents per ball while
in the old process it is 60 cents. The balls are sold at $2.00
each.
If the manufacturer wishes to maximize his expected profit,
which process should he use?
week7
19
Exercise
A set of 10 cards consists of 5 red cards and 5 black cards. The
cards are shuffled thoroughly and I am given the first four
cards. I count the number of red cards X in these 4 cards.
The r. v. X has which of the following probability
distributions?
a) B(10, 0.5)
b) B(4, 0.5)
c) None of the above.
week7
20
Exercise
• There are 20 multiple-choice questions on an exam, each
having responses a, b, c, and d. Each question is worth 5
points. And only one response per question is correct. Suppose
that a student guesses the answer to question and her guesses
from question to question are independent. If the student needs
at least 40 points to pass the test. What is the probability that
the student will pass the test?
• What is the expected (mean) score for this student.
week7
21