Lab Assignment 2

advertisement
General Instructions
I
In addition to giving the answers, you should copy the
commands you use and the response R gives from the R
console and paste it in the word document.
I
Upload your Lab Assignment 2 word document on Angel.
M. George Akritas
Lab Assignment 2
Exercise 1
This activity uses the integrate function in R, similar to the first
slide of the Integration in R section of the R tutorial on Joint
PMFs:
The random variable P, which takes values between 0 and 1, has
pdf fP (p) = .07p −0.93 .
1. Compute the probability P(P ≤ 0.2) using the commands:
a) f=function(p){.07*p**(-0.93)} (this defines the pdf as the
function f in R), and b) integrate(f,lower=0,upper=.2).
2. Confirm that fP (p) is a proper pdf by computing the area
under the curve from 0 to 1.
M. George Akritas
Lab Assignment 2
Exercise 2
Let X and Y be independent with X be hypergeometric with
M = 6, N = 20 and n = 2, and Y be hypergeometric with M = 8,
N = 20 and n = 3. The pages mentioned below refer the R
tutorial on Joint PMFs.
1. Form the matrix of joint probabilities of X and Y . (See p. 4
for similar commands.)
2. Use the matrix of joint probabilities to find the marginal
PMFs of X and Y , as well as the conditional pmf of Y given
that X = 1. (Similar commands are given in p. 4 and p. 3.)
3. Find the probability P(X + Y ≤ 3). (Similar commands are
given in p. 5.)
4. Find the expected value E (X + Y )2 ). (Similar commands are
given in p. 9)
M. George Akritas
Lab Assignment 2
Download