Cristian M. answered 06/28/22
MS Statistics Graduate with 5+ Years of Tutoring Experience
Suppose the joint distribution of random variables X and Y is given as:
a)
I'll leave the Python implementation to you. As for p(x), we're considering each x-value (regardless of y), so let's add up across each row since X is defined along the rows: The x = 0 row has 0.1 + 0.05 + 0.05 = 0.2. The x = 1 row has 0.2 + 0.15 + 0.05 = 0.4. The x = 2 row has 0.1 + 0.1 + 0.2 = 0.4. So the marginal distribution p(x) is x: {0, 1, 2}, p(x): {0.2, 0.4, 0.4} (imagine this as a table or as a piecewise function). Note that the values in p(x) add up to 1.
b)
Similarly, for p(y), we're considering each y-value (regardless of x), so let's add down each column since Y is defined along the columns: The y = 0 column has 0.1 + 0.2 + 0.1 = 0.4. The y = 1 column has 0.05 + 0.15 + 0.1 = 0.3. The y = 2 column has 0.05 + 0.05 + 0.2 = 0.3. So the marginal distribution p(y) is y: {0, 1, 2}, p(y): {0.4, 0.3, 0.3}. Note that the values in p(y) add up to 1.
c)
Follow the definition: add up each product of x and P(X = x). We have these from the marginal distribution p(x) already! Imagining that this is a table, multiply each pair of x-value and p(x)-value and add them.
x: {0, 1, 2}, p(x): {0.2, 0.4, 0.4}
E(X) = 0(0.2) + 1(0.4) + 2(0.4) = 1.2.
d)
We have half of this work done already. Remember that Var(X) = E(X2) - (E(X))2.
We can write this already: Var(X) = E(X2) - (1.2)2 = E(X2) - 1.44.
Finding E(X2) is similar to finding E(X); just square each x-value and proceed as usual:
x: {0, 1, 2}, p(x): {0.2, 0.4, 0.4}
E(X2) = 02(0.2) + 12(0.4) + 22(0.4) = 2
Back to the variance:
Var(X) = E(X2) - 1.44 = 2 - 1.44 = 0.56
e)
This is found by ∑∑(xy)p(x,y), across all x-values and across all y-values. Note that p(x,y) is a joint probability, and each value of it is simply the value in each of the cells in the original table.
Don't get too boggled down by this representation, and just do what it tells you to do: Find all products of x- and y- values and joint probability (there are 9 products since the table has 9 cells).
E(XY) = (x=0)(y=0)(0.1) + (x=0)(1)(y=0.05) + (x=0)(y=2)(0.05)
+ (1)(0)(0.2) + etc.
+ (2)(0)(0.1) + etc.
Make sure you've added 9 such products together. I'll let you take care of this one. :)
I hope this helps!