Question 6) Suppose X is a random variable taking on possible values 0,2,4 with respective probabilities .5, .3, and .2. Y is a random variable independent from X taking on possible values 1,3,5 with respective probabilities .2, .2, and .6. Use R to determine the following.
a) Find the probability P(X*Y = 4)
b) Find the expected value of X.
c) Find the variance of X.
d) Find the expected value of Y.
e) Find the variance of Y.
Here is the output of R
> x=c(0,2,4)
> x
[1] 0 2 4
> #px=probabilities of x
> px=c(0.5,0.3,0.2)
> px
[1] 0.5 0.3 0.2
> y=c(1,3,5)
> #py=probabilities of y
> py=c(0.2,0.2,0.6)
> py
[1] 0.2 0.2 0.6
> #Q.a
> #p1=p(x*y=4)
> #p1=p(x=4,y=1), Since x=4, y=1 only gives x*y=4
> p1=px[3]*py[1]
> p1
[1] 0.04
> #Q.b
> Ex=sum(x*px)
> Ex
[1] 1.4
> #Q.c
> Vx=(sum(x^2*px))-(Ex^2)
> Vx
[1] 2.44
> #Q.d
> Ey=sum(y*py)
> Ey
[1] 3.8
> #Q.c
> Vy=(sum(y^2*py))-(Ey^2)
> Vy
[1] 2.56
Get Answers For Free
Most questions answered within 1 hours.