I had a statistics question I was hoping for help on:
Let $Y_1$ and $Y_2$ be discrete random variables with join probability function:
$$f(x,y) = \begin{cases} \dfrac{y_1 + 2y_2}{18} & \text{if $y_1 = 1,2 ; y_2 = 1,2$} \\ 0 & \text{elsewhere} \end{cases}$$
Find the covariance of $Y_1$ and $Y_2$.
Below is my work, would anyone be able to let me know if I'm right or if there are any errors? Thank you so much in advance, I really appreciate it!
Probabilities derived from the above function:
$(Y_1,Y_2)$
$(1,1) = \dfrac{1}{6}$, $(2,1) = \dfrac{2}{9}$
$(1,2) = \dfrac{5}{18}$, $(2,2) = \dfrac{1}{3}$
Marginal Probabilities from the above probabilities:
$p_1(1)$ = $\dfrac{4}{9}$
$p_1(2)$ = $\dfrac{5}{9}$
$p_2(1)$ = $\dfrac{7}{18}$
$p_2(2)$ = $\dfrac{11}{18}$
$E[Y_1 Y_2] = (1)(1)(1/6)+(1)(2)(2/9)+(2)(1)(5/18)+(2)(2)(1/3) = \dfrac{5}{2}$
$E[Y_1]$ = (1)(4/9)+(2)(5/9) = $\dfrac{14}{9}$
$E[Y_2] = (1)(7/18) + 2(11/8) = \dfrac{29}{18}$
$$\operatorname{Cov}(Y_1,Y_2)=E[Y_1 Y_2]-E[Y_1] E[Y_2] = \frac{5}{2} - \frac{14}{9} \cdot \frac{29}{18} = -\frac{1}{162}$$
You can easily check your work with a computer algebra system. There are a number of such packages around, for applications such as Maple and Mathematica. For your example, the bivariate joint pmf of $(Y_1,Y_2)$ is given as $f(y_1,y_2)$:
$$f=\frac{1}{18} \left(y_1+2 y_2\right); \quad \text{domain}[f] = \{ \{y_1, 1, 2\}, \{y_2, 1, 2\} \} \text{ && } \{Discrete\};$$
You seek:
$\quad \text{Cov}[\{y_1, y_2\},f]$
where I am using the
Covfunction from the mathStatica package for Mathematica to automate. As disclosure, I should perhaps mention that I am one of the authors.