Stat 330 Homework 9 Spring 2009 1

advertisement
Stat 330
1
Homework 9
Spring 2009
Old Exam Question (Modified/Extended)
The following ten numbers are realizations of a standard uniform distribution:
0.8300 0.7064 0.3631 0.2305 0.0425 0.1910 0.9743 0.8571 0.6642 0.1908
(a) Explain how you can use the numbers above to generate 10 iid Bernoulli random variables, Y1 , . . . , Y10 ,
with a success probability of p = .2. What ten values of the Bernoulli random variables do you obtain?
We can use the inverse method for discrete distributions to transform the ten iid standard uniform
numbers to ten realizations iid Bernoulli trials. One way to do this is to set
(
0 if Ui ≤ .8
Yi =
1 otherwise.
The above rule gives the following outcomes for the Bernoulli r.v.’s Y1 , . . . Y10 :
Y1
1
Y2
0
Y3
0
Y4
0
Y5
0
Y6
0
Y7
1
Y8
1
Y9
0
Y10
0
(b) Describe how you can use these numbers to find realizations of a Geo0.2 distribution. Then give the first
two Geo0.2 random numbers X1 , X2 based on the numbers above. We can use the relationship between
the Bernoulli and the geometric distributions to generate realizations from a Geo.2 distribution. Since
X ∼Geometric(.2), if X is the trial on which the first success occurs in a sequence of iid Bernoulli
trials, each with a success probability of .2, we can generate X1 by looking at the above sequence of
Bernoulli tials and setting X1 to be the trial on which the first success occurs. In this case, using the
table above, X1 = 1 because the first 1 in the Table above occurs on the first trial (Y1 = 1). Likewise,
the number of trials between the first success and the second success has a geometric distribution with
p = .2 (this is the memoriless property of the geometric). Therefore, the number of additional trials
required for the second success to occur has geometric distribution with p = .2. In the table above, there
are 6 additional trials needed for the second success to occur, so X2 = 6 in this case.
(c) How can you use the numbers above to generate a X ∼Binomial(n =10,p =.2)? What value of X do
you obtain? Using the connection between the Binomial and the Bernoulli, we know that the sum of
10 iid Bernoulli random variables with a success probability of p = .2 has a Binomial distribution with
n = 10 and p = .2 Since
Y1 + . . . + Y10 = 3,
the realization from the binomial that we generate in this case is X = 3.
(d) Assume, variable X has distribution function FX given as


0
FX (x) = ln(x + 1)


1
if x < 0,
if 0 ≤ x ≤ e − 1,
otherwise.
Describe how you can use a random number from a standard uniform distribution to find a realization
of FX . (Hint: Use the inverse method for continuous random variables.) Then give the first two
random numbers X1 , X2 based on the first two numbers above.
1
For each u in the interval from 0 to 1, we need to find the value of x such that FX (x) = u. Mathematically, one way to do this is as follows:
u = FX (x) ↔
u = ln(x + 1)
↔
eu = x + 1
↔
x = eu − 1.
−1
Then, the inverse of the cdf, FX
(u), is obtained from the last line in the expression above. Namely,
−1
FX
(u) = eu − 1.
Plugging the first two uniform numbers into the inverse cdf gives
X1
= e0.8300 − 1 = 1.293
X2
= e0.7064 − 1 = 1.027
(e) How can you use the numbers above to generate X ∼Erlang(K = 10,λ = 3)? You do not need to
compute the actual value; just describe the procedure.
Using the inverse method for continuous random variables, we can generate X1 , . . . , X10 ∼iid
Exponential(λ = 3) by calculating
1
Xi = − ln(1 − Ui ),
3
for i = 1, . . . , 10. By the definition of an Eralang random variable, X ∼Erlang(K = 10,λ = 3) means
that X = X1 + . . . + X10 , where X1 , . . . X10 ∼iid Exponential(λ = 3). The values of X1 , . . . , X10 for
the uniform numbers above are these:
0.062 0.116 0.338 0.489 1.053 0.552 0.009 0.051 0.136 0.552.
Adding up the numbers X1 , . . . , X10 gives X = 3.358 for the value of the Erlang random variable.
2
Download