Download stdin (ditroff) - Purdue Engineering

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

History of statistics wikipedia , lookup

Foundations of statistics wikipedia , lookup

Infinite monkey theorem wikipedia , lookup

Birthday problem wikipedia , lookup

Inductive probability wikipedia , lookup

Risk aversion (psychology) wikipedia , lookup

Expected value wikipedia , lookup

Law of large numbers wikipedia , lookup

Transcript
Homework #10. Solution.
IE 230
Textbook: D.C. Montgomery and G.C. Runger, Applied Statistics and Probability for Engineers, John
Wiley & Sons, New York, 1999. Chapter 6, Sections 6.1-6.2. Pages 12-13 of the concise notes.
1. Consider rally-point volleyball, where a point is scored with each volley. (In more-traditional
volleyball, only the serving team scores.) The team winning the volley gets both the point and
the right to serve next.
Let Xi = "the number of points scored by our team on volley i", for i = 1, 2,.... (Because the
number of points is either zero or one, Xi is an indicator variable for the result of volley i.)
Make two assumptions:
— Other than for the effect due to who serves, the result of each serve is independent of
other volleys.
— The serving team wins the volley with probability p. (Throughout, you may use the
specific value p = .6 if that helps you think about the problem. If you are comfortable
using the general p, do that.)
Suppose that we have won the coin flip, so we serve first.
(a) State the marginal pmf of X 1 .
-----------------------------------------------------------------------------------------Because we serve first,
I
J
fX (x) = P(X 1 = x) =
K
1
J
L
p
if x = 1
1−p if x = 0
0
elsewhere
Because p = .6,
I
J
fX (x) =
K
1
J
L
.6 if x = 1
.4 if x = 0
0 elsewhere
-----------------------------------------------------------------------------------------(b) State the conditional pmf for X 2 given X 1 = 1. For X 2 given X 1 = 0.
-----------------------------------------------------------------------------------------Because X 1 = 1 implies that we serve the second volley,
I
fX | X
2
1
= 1 (x)
= P(X 2 = x | X 1 = 1) =
J
K
J
L
p
if x = 1
1−p if x = 0
0
elsewhere
Because X 1 = 0 implies that they serve the second volley,
I
fX | X
2
1
= 0 (x)
= P(X 2 = x | X 1 = 0) =
J
K
J
L
1−p if x = 1
p
if x = 0
0
elsewhere
------------------------------------------------------------------------------------------
- 1 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(c) State the joint pmf for (X 1 , X 2 ).
-----------------------------------------------------------------------------------------REVIEW: The multiplication rule says that fX , X (x 1, x 2 ) = fX (x 1 ) fX | X
Why? Remember that pmfs are probabilities. More formally,
1
2
1
2
1
= x 1 (x 2 ).
Result: For discrete random variables X 1 and X 2 ,
fX
1
x 2 ) = fX (x 1 ) fX | X
, X 2 (x 1,
1
2
1
= x 1 (x 2 )
for all real numbers x 1 and x 2 .
Proof: For any real numbers x 1 and x 2 ,
fX
1
, X 2 (x 1 ,
x 2)
= P(X 1 = x 1 , X 2 = x 2 )
def. of joint pmf
= P(X 1 = x 1 ) P(X 2 = x 2 | X 1 = x 1 )
multiplication rule
= fX (x 1) fX | X
def. of marginal
and conditional pmfs
1
2
1
= x 1 (x 2 )
SOLUTION: Applying the multiplication rule from Parts (a) and (b) yields
I
J
J
fX
1
, X 2 (x 1,
x 2 ) = fX (x 1 ) fX | X
1
2
1
J
=
= x 1 (x 2 )
K
J
J
J
I
.36
.24
.16
.24
0
J
J
1
, X 2 (x 1,
if (x 1 , x 2 ) = (1, 1)
if (x 1 , x 2 ) = (1, 0)
if (x 1 , x 2 ) = (0, 1)
if (x 1 , x 2 ) = (0, 0)
elsewhere
L
Substituting p = .6 yields
fX
(p)(p)
(p)(1−p)
(1−p)(1−p)
(1−p)(p)
0
x 2) =
J
K
J
J
J
if (x 1 , x 2 ) = (1, 1)
if (x 1 , x 2 ) = (1, 0)
if (x 1 , x 2 ) = (0, 1)
if (x 1 , x 2 ) = (0, 0)
elsewhere
L
-----------------------------------------------------------------------------------------(d) Show the joint pmf for (X 1 , X 2 ) in a table. Show the marginal distributions of X 1 and of X 2 in
the table margins.
-----------------------------------------------------------------------------------------For general p and for p = .6, the tables are
c
0
X2
c
1
fX
1
c
c
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
c
X1 = 0
(1−p)(p)
c
c
(1−p)(1−p)
1−p
c
X
(p)(p)
c p
1 = 1 c (p)(1−p)
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
c
fX
2
c
2p (1−p)
p 2 +(1−p)2
c
c
1
c
0
X2
c
1
fX
1
c
c
iiiiiiiiiiiiiiiiiiiii
c
X1 = 0
.24
c
c
.16
.4
c
X
.36 c .6
1 = 1 c .24
iiiiiiiiiiiiiiiiiiiii
c
fX
2
c
c
.48
.52
c
1
------------------------------------------------------------------------------------------
- 2 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(e) Expected values are one measure of the importance of serving first. What is the expected
number of points that we score in the first volley? The second volley? (That is, what is the
marginal expected value of X 1 ? Of X 2 ?) As i increases, what do you think is the value of
E(Xi )?
-----------------------------------------------------------------------------------------The first question is about a single random variable, X 1 .
Σ x fX (x)
=
E(X1 )
def. of expected value
1
all x
= (0)fX (0) + (1)fX (1)
the range of X 1 is zero and one
= (0)(1−p) + (1)(p)
substituting from Part (a)
= p
simplifying
= .6
substituting given information
1
1
As we have seen before, the expected value of an indicator variable is
the probability that the event occurs. That is, we could have just
written E(X 1 ) = fX (1) = p.
1
The second question is also about a single random variable, X 2 .
E(X2 )
=
Σ x fX (x)
def. of expected value
2
all x
= (0)fX (0) + (1)fX (1)
the range of X 2 is zero and one
= (0)[2p (1−p)] + (1)[p 2 + (1−p)2]
substituting from Part (d)
= p 2 + (1−p)2
simplifying
= .36 + .16
substituting given information
= .52
simplifying
2
2
As with X 1 above, the expected value is the probability that the event occurs.
That is, we could have just written E(X 2 ) = fX (1) = p 2 + (1−p)2 = .52.
-----------------------------------------------------------------------------------------2
- 3 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(f) Find the conditional pmf of X 1 given X 2 = 1. Find the conditional pmf of X 1 given X 2 = 0.
-----------------------------------------------------------------------------------------REVIEW: Again the pmfs are probabilities, which yields the following result.
Result: For any discrete random variables X 1 and X 2 ,
fX | X
2
= x 1 (x 2 )
1
fX
=
1
, X 2 (x 1 ,
x 2)
h
hhhhhhhhhhh
fX (x 1 )
1
for all real numbers x 1 and x 2 .
Proof:
fX | X
2
1
= P(X 2 = x 2 | X 1 = x 1 )
= x 1 (x 2 )
P(X 1 = x 1 , X 2 = x 2 )
P(X 1 = x 1 )
=
hhhhhhhhhhhhhhhhh
=
h
hhhhhhhhhhh
fX
1
, X 2 (x 1 ,
x 2)
def. of conditional pmf
def. of conditional probabiity
definition of joint and
fX (x 1 )
1
conditional pmf
SOLUTION: Using the result yields
fX | X
2
1
=
= 1 (x 2 )
fX
1
, X 2 (1,
x 2)
the result
h
hhhhhhhhhh
fX (1)
1
=
I
K
L
=
I
K
L
if x 2 = 1
p2 / p
p (1−p) / p if x 2 = 0
p
(1−p)
if x 2 = 1
if x 2 = 0
substituting from Parts (a,c)
simplifying
Alternatively, you could argue that, based on the "story",
fX | X
2
1
= 1 (x)
= fX (x) for any real number x.
1
Similarly, the result yields
fX | X
2
1
= 0 (x 2 )
=
fX
1
, X 2 (0,
x 2)
the result
h
hhhhhhhhhh
fX (0)
1
=
I
K
L
=
I
K
L
(1−p)2 / (1−p) if x 2 = 1
p (1−p) / (1−p) if x 2 = 0
1−p
p
if x 2 = 1
if x 2 = 0
substituting from Parts (a,c)
simplifying
------------------------------------------------------------------------------------------
- 4 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(g) Are X 1 and X 2 independent?
Explain why in words?
-----------------------------------------------------------------------------------------No. Winning the first volley gains us the second serve
which improves our chancesof winning the second volley.
-----------------------------------------------------------------------------------------Show why in terms of probabilities.
-----------------------------------------------------------------------------------------To show dependence, we need only to find one pair of
real numbers (x 1 , x 2 ) so that fX (x 2 ) =/ fX | X = x (x 2 ).
Let’s choose (x 1 , x 2 ) = (0,0), for which
fX (0) = .48 but fX | X = 0 (0) = .4.
-----------------------------------------------------------------------------------------2
2
2
2
1
1
1
(h) (Not to submit) Write the joint pmf for (X 1 , X 2 , X 3 ).
-----------------------------------------------------------------------------------------SOLUTION: Applying the multiplication rule, but now another level deep, yields
fX
1
, X 2 , X 3 (x 1,
x 2 , x 3 ) = fX (x 1 ) fX | X
1
2
1
= x 1 (x 2 ) fX 3 | X 1 = x 1 , X 2 = x 2 (x 3 )
I
J
J
J
J
J
=
J
K
J
J
J
J
J
J
L
(p)(p)(p)
(p)(1−p)(1−p)
(1−p)(1−p)p
(1−p)(p)(1−p)
(p)(p)(1−p)
(p)(1−p)(p)
(1−p)(1−p)(1−p)
(1−p)(p)(p)
0
if (x 1 , x 2 , x 3 ) = (1, 1, 1)
if (x 1 , x 2 , x 3 ) = (1, 0, 1)
if (x 1 , x 2 , x 3 ) = (0, 1, 1)
if (x 1 , x 2 , x 3 ) = (0, 0, 1)
if (x 1 , x 2 , x 3 ) = (1, 1, 0)
if (x 1 , x 2 , x 3 ) = (1, 0, 0)
if (x 1 , x 2 , x 3 ) = (0, 1, 0)
if (x 1 , x 2 , x 3 ) = (0, 0, 0)
elsewhere
-----------------------------------------------------------------------------------------(i) (Not to submit) Generalize the model by letting p 1 be the probability that we score when we
serve and letting p 2 be the probability that they score when they serve. Rework Parts (a-h).
-----------------------------------------------------------------------------------------Structurally, nothing changes. Each time p is used, however,
we now need to use p 1 when we are serving and p 2
when they are serving.
-----------------------------------------------------------------------------------------(j) (Not to submit) Each volley is similar to a Bernoulli trial. What Bernoulli trial assumption
does not hold?
-----------------------------------------------------------------------------------------A sequence of Bernoulli trials must have a common probability of success.
Here the probability of success depends upon the previous trial, which
in turn causes dependence among the trials.
------------------------------------------------------------------------------------------
- 5 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
2. (A multinomial problem.) The family reunion was boring Uncle Jack, so he proposed a game.
"Hey kids, I have ten silver dollars here." The three older kids (Agnes, age 14; Billy Bob, age
10; and Cecil, age 7) looked up, interested, but Baby Dorothy (age 6 months) seemed to ignore
Uncle Jack.
Suddenly, he threw the ten dollars into the air, yelling "Finders keepers", much to the horror of
several parents.
While Uncle Jack is having his sadistic fun watching the three greedy older kids fight over the
money, let’s have some (much more civilized) probability fun. To begin, let Xi denote the
number of dollars that kid i gets, for i = 1, 2, 3, 4. (As usual, the ordering is alphabetical, so—
once again—Agnes gets to be first.)
(a) For any particular dollar, let pi denote the probability that kid i gets the dollar. State some
reasonable values for pi for i = 1,...,4.
-----------------------------------------------------------------------------------------It seems reasonable that p 1 > p 2 > p 3 > p 4 ,
with p 4 barely positive. Also, of course, p 1 + . . . + p 4 = 1.
We choose p 1 = .45, p 2 = .35, p 3 = .199 and p 3 = .001.
-----------------------------------------------------------------------------------------(b) For the random vector (X 1 , X 2 , X 3 , X 4 ) to have a multinomial distribution, the multinomial
trials need to be independent. Here independence means that the keeper of dollar j is
independent of the keeper of dollar k whenever j =/ k. Argue for or against an independence
assumption here.
-----------------------------------------------------------------------------------------Not independent. While one kid is picks up a dollar, the other kids are still busy
looking and picking up. Therefore, there is a balancing effect that would not be seen
in independent multinomial trials.
Essentially independent trials would occur in a variation of the game in which Uncle
Jack, to extend his joy, tosses the coins high in the air, but only one every fifteen
seconds.
When tossed simultaneously, P(X 1 = 10) < p 10
1 , which would be the value if the trials
were independent.
-----------------------------------------------------------------------------------------(c) Now assume independence among the n = 10 trials. Write the expression for the probability
that Agnes gets five dollars, Billy Bob gets no dollars, Cecil gets five dollars, and Baby
Dorothy gets no dollars.
-----------------------------------------------------------------------------------------P(X 1 = x 1 , X 2 = x 2 , X 3 = x 3 , Xk = xk ) =
n!
x
x
x
x
p1 p2 p3 pk
.
.
.
x 1! x 2!
xk !
h
hhhhhhhhhhhh
1
2
3
k
10!
p 51 p 02 p 53 p 04
5! 0! 5!0!
=
hhhhhhhh
=
h
hhhhhhhhhhhhh
(10)(9)(8)(7)(6)
.455 .350 .1995 .0010
(5)(4)(3)(2)
≈ (252) (0.1845) (1) (0.00031) (1)
≈ 0.01541
←
The reasons are (1) assume multinomial, (2) substitute given observed values, (3)
substittue assumed parameter values, (4) simplify, and (5) simplify.
------------------------------------------------------------------------------------------ 6 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(d) Although Baby Dorothy did not notice, one of the dollars fell into her diaper. Because of the
condition of her diaper, the older kids graciously allowed her to keep the dollar; because
she was an inefficient searcher and fighter, she got not other dollars. So, surprisingly,
X 4 = 1.
-----------------------------------------------------------------------------------------Unintentionally, there is no question here.
-----------------------------------------------------------------------------------------(e) P(X 4 = 1) is binomial. (Do you understand why?) What are the values of the binomial
parameters n and p? Write the probability in terms of the general p 4 .
-----------------------------------------------------------------------------------------The binomial parameters are n = 10 dollars and p = p 4 .
-----------------------------------------------------------------------------------------(f) We are interested in the distribution of (X 1 , X 2 ,X 3 ) conditional on X 4 = 1.
(i) First approach. There are nine dollars left. Still assuming that each dollar’s keeper is
independent, the distribution is multinomial with n = 9 and probabilities ri for the older
three kids, i = 1, 2, 3. Show that ri = pi / (p 1 + p 2 + p 3 ).
-----------------------------------------------------------------------------------------Think of each trial (dollar) as an experiment. Let Ki denote the event that kid i
gets the dollar.
ri
= P(Ki | K 4 ′)
by definition of ri
=
hhhhhhhhhhhh
P(Ki and K 4 ′)
P(K 4 ′)
by definition of conditional probability
=
hhhhhh
P(Ki )
P(K 4 ′)
the Ki s are mutually exclusive
=
hhhhhhhhh
pi
1 − P(K 4 )
complementary event
=
hhhhhh
pi
1 − p4
definition of p 4
=
hhhhhhhhhhh
pi
p1 + p2 + p3
Axiom 1 (the pi s sum to one)
------------------------------------------------------------------------------------------
- 7 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
(ii) Second approach. By definition, the conditional pmf is the joint pmf divided by the
probability of the conditioning event. The joint probability is the original multinomial
pmf (similar to Part (c)) with argument (x 1 , x 2 , x 3 , 1). The conditioning event is X 4 = 1
(as in Part (e)). Write the fraction and simplify to obtain the conditional pmf.
-----------------------------------------------------------------------------------------P(X 1 = x 1 , X 2 = x 2 , X 3 = x 3 , X 4 = x 4 | X 4 = x 4 ) =
=
P(X 1 = x 1 , X 2 = x 2 , X 3 = x 3 , X 4 = x 4 and X 4 = x 4 )
P(X 4 = x 4 )
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
P(X 1 = x 1 , X 2 = x 2 , X 3 = x 3 , X 4 = x 4 )
P(X 4 = x 4 )
h
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
n!
x
x
x
x
p1 p2 p3 p4
x 1! x 2! x 3 x 4!
hhhhhhhhhhhh
=
1
2
3
4
hhhhhhhhhhhhhhhhhhhhhhhhh
n!
x
n−x
p 4 (1 − p 4 )
(n − x 4 )! x 4 !
hhhhhhhhhhh
4
x1
(n − x 4 )! x 4 !
=
x 1! x 2! x 3 x 4!
hhhhhhhhhhhh
(n − x 4 )!
x 1! x 2! x 3
=
hhhhhhhhh
=
hhhhhhhhh
x2
x3
4
x4
p1 p2 p3 p4
h
hhhhhhhhhhhhh
x4
p 4 (1 − p 4 )
x1
x2
n − x4
x3
p1 p2 p3
hhhhhhhhhhh
(1 − p 4 )
n − x4
(n − x 4 )! x x x
r1 r2 r3
x 1! x 2! x 3
1
2
3
The reasons are (1) definition of conditional probability, (2) probability of the
same event, (3) assume multinomial and binomial distributions, (4) simplify, (5)
simplify, and (6) definition of ri .
-----------------------------------------------------------------------------------------(iii) The first and second approaches yield the same conditional distribution, but with a
subtle difference. Consider the case of p 4 = 0, where Baby Dorothy was given no
chance of obtaining any dollar. The first approach yields the multinomial distribution
with n = 9 and ri = pi ; that is, the Baby Dorothy’s dollar just disappeared from the
model. The second approach says that the distribution conditioned on X 4 = 1 is not
defined. Discuss. (For example, does one seem "right" to you? Do both seem "right",
but in different ways?)
-----------------------------------------------------------------------------------------The first approach simply removes Baby Dorothy and her dollar from the
experiment. This approach is equivalent to Uncle Jack giving the dollar to Baby
Dorothy outside of the experiment (and therefore the influences of the trial
probabilities).
The second approach does not change the experiment and is therefore the better
solution.
------------------------------------------------------------------------------------------
- 8 of 9 -
Schmeiser
Homework #10. Solution.
IE 230
3. Computing the multivariate pmf. (Do not submit an MSExcel spread sheet.) First read the handout
(on the web page) about computing probabilities using the gamma function and logarithms.
(a) Determine the largest value of x so that fact (x) does not overflow. Write the command, the
argument value, and the function value.
-----------------------------------------------------------------------------------------On my Purdue NT server, =fact(170) yields 7.257 × 10306
but =fact(170) yields "#NUM!", indicating overflow.
-----------------------------------------------------------------------------------------(b) Write the MSExcel cell command to evaluate 5! using the gammaln function.
-----------------------------------------------------------------------------------------=exp( gammaln(5+1))
-----------------------------------------------------------------------------------------(c) Using "exp", "ln", and "gammaln" functions, write the MSExcel cell command to evaluate the
binomial probability P(X = 80) for n = 200 and p = .4. Write its value. (You might want to
check your answer with the "binomdist" function.).
------------------------------------------------------------------------------------------
f (x) = (n ! / (x ! 1(n −x))) p x (1−p)n −x
= exp[gammaln(n +1) + xlnp + (n −x)ln(1−p) − gammaln(x +1) − gammaln(n −x +1)]
Therefore, the MSExcel command is
=exp ( gammaln(201) + 80*log(.4) + 120*log(.6) - gammaln(81) - gammaln(121)
-----------------------------------------------------------------------------------------(d) Write MSExcel code and value for the probability in 2(c).
- 9 of 9 -
Schmeiser