Looking for part e and part f if anyone could help I would b
Looking for part (e) and part (f) if anyone could help I would be forever grateful
2. Conditional Probability and Expectation: Suppose X and Y are discrete random variables. X is uniformly distributed on the set 10,1,...n, while Y is conditionally uniform on 0 throughi given Xi, for each i-0, ,n. (a) Compute the conditional mlean E(Y|X = z) for a general i-n (b) Compute E(Y) by conditioning on the values of X, namely, using the formula E(Y)-2n:0 E(YIX-i)px (i), where px(i) = Prob(X = i) (c) Find the joint probability mass function (prf) p(i, j) Prob(X-i,V-J), for i 0,...,n and j-0,... ,n. (hint: for some pair (i,j) the joint pmf is zero Make sure you clearly identify those) (d) Compute the marginal py(j)-Prob(Y-j) for j = 0, . . . n. (e) Write a matlab function to compute the mean E(Y) of Y using pY for n = 100, and compare the result with (b) (f) Assume n-1. Let g(X) = 2, if X = 1 or n, and g(X) = 0 otherwise. Compute E(g(X)Y) through conditional expectationSolution
(f)
Given that g(X)= 2 if X=1or n and g(X)=0 iotherwise
Then
E[g(x)Y]
=EE[g(X)Y|X]
=E[g(X)E{Y|X}]
=E[g(X)X/2]
=E[Xg(X)]/2
=0.5[1*2*1/n + n*2*1/n]
=1+1/n
(e)
Matlab command
x=datasample(0:100,1);
y=datasample(0:x,1);
y;
For an execution of the above codes it may be found x=56,y=43 (another execution may give another output)
Theoretically for n=100, E[Y] =n/4 = 100/4 = 25.
The simulated value and the theoretical values, though not close, may become close if multiple samples are drawn.
