typed answers with explanation either in doc or in pdf.
strict due. by midnight 10/01in MST
for Q5, you will need to use R program http://www.r-project.org.
I also need coding (detail procedure you operate )of it.
you may use this for Q5.
# hmwk5_r.txt
# p is probability of heads
p=0.25;
for (n in 1:20) {
# seq is used to record the flips
seq=as.character();
# flip until we get H
count1<-0;
got_head<-0;
while (got_head==0) {
count1<-count1+1;
flip<-rbinom(1,1,p);
if (flip==0) seq=paste(seq,"T");
if (flip==1) seq=paste(seq,"H");
if (flip==1) got_head<-1;
}
# now flip until we get T
count2<-0;
got_tail<-0;
while (got_tail==0) {
count2<-count2+1;
flip<-rbinom(1,1,p);
if (flip==0) seq=paste(seq,"T");
if (flip==1) seq=paste(seq,"H");
if (flip==0) got_tail<-1;
}
cat(sprintf("%s: X is %d+%d=%d \n",seq,count1,count2,count1+count2));
}
Math 464 – Fall
1
3 – Homework 5
1. Roll two four-sided dice. Let
X = number of odd dice
Y = number of even dice
Z = number of dice showing 1 or
2
So each of X, Y, Z only takes on the values 0, 1, 2.
(a) Find the joint p.m.f. of (X,Y). Find the joint p.m.f. of (X,Z). You can
give your answers in the form of 3 by 3 tables.
(b) Are X and Y independent? Are X and Z independent?
(c) Compute E(XY ) and E(XZ).
2. Let X, Y be independent random variables with
E[X] = −2, E[Y ] = −1,
E[X2] = 5, E[Y 2] = 5,
E[X3] = 10, E[Y 3] = −13,
E[X4] = 50, E[Y 4] = 73
Let Z = X + 2Y . Find the mean and variance of Z
Let W = X − 2Y 2. Find the mean and variance of W
3. Let X and Y be independent random variables. Each of them has a
geometric distribution with E[X] = 2 and E[Y ] = 3.
(a) Find the joint p.m.f. of X and Y .
(b) Compute the probability that X + Y ≤ 4.
(c) Define two new random variables by W = min{X, Y } and Z = max{X, Y }.
Find the joint p.m.f. of W and Z.
1
4. An unfair coin has probability p of heads. I flip it until I get heads, then
I flip it some more until I get tails. Let X be the total number of flips. So
here are some possible outcomes:
HT : X = 2
THT : X = 3
HHHHT : X = 5
TTHHHHT : X = 7
(a) Find the mean and variance of X. Hint: write X as the sum of two
random variables.
(b) Now let Y be the number of heads minus the number of tails. Find the
mean and variance of Y .
5. Write an R program to check your answers to the previous problem when
p = 1/4. You should turn in your program and the output you get when
you run it. To get you started there is an R program on the web for this
homework which will generate 20 samples of the sequence of flips and the
values of X for the flips. You will need to modify it to compute Y for the
flips and have it generate a much larger number of samples, say 100, 000.
One way to estimate the mean and variance of X is to use the simulation to
estimate E[X] and E[X2]. Another way is to compute the “sample standard
deviation” of your sample of values of X. If x is a vector with the samples,
then sd(x) will compute its standard deviation.
6. (Exposition) N is a RV with a Poisson distribution with parameter λ. A
coin has probability p of heads. We flip the coin N times. Let X and Y be
the number of heads and tails respectively. Assume that the process which
generates N is independent of the coin.
(a) Find the distributions of X and Y .
(b) Show that X and Y are independent.
2