\[E(g(X,Y)) = \sum_{x}\sum_y g(x,y)\,p_{X,Y}(x,y)\] * If \(X\) and \(Y\) are jointly continuous random variables with joint pdf \(f_{X,Y}(x,y)\), then:
\[E(g(X,Y)) = \int_{-\infty}^\infty\int_{-\infty}^\infty g(x,y) f_{X,Y}(x,y)\, dx\,dy\]
\[E(cg(X,Y)) = cE(g(X,Y))\]
\[E\left(g_1(X,Y) + g_2(X,Y) + ... + g_k(X,Y)\right) = E(g_1(X,Y)) + E(g_2(X,Y)) + ... + E(g_k(X,Y))\]
For bivariate continuous (holds for bivariate discrete, and for \(X\) instead of \(Y\)):
\[E(g(Y)) = \int_{-\infty}^\infty \int_{-\infty}^\infty g(y) f_{X,Y}(x,y)\, dx\,dy\] \[ = \int_{-\infty}^\infty g(y) \left(\int_{-\infty}^\infty f_{X,Y}(x,y)\, dx\right)\,dy\] \[ = \int_{-\infty}^\infty g(y) f_Y(y)\,dy \]
In other words, if we need to find the mean of a function of just one of the random variables, we have the option of working with the marginal distribution of that random variable.
\[E(h(X)g(Y)) = E(h(X)) E(g(Y))\]
Proof for jointly continuous case:
\[ E(h(X)g(Y))= \int_{-\infty}^\infty\int_{-\infty}^\infty h(x)g(y) f_{X,Y}(x,y)\, dx\,dy\]
\[ = \int_{-\infty}^\infty\int_{-\infty}^\infty h(x)g(y) f_{X}(x)f_Y(y)\, dx\,dy\]
\[ = \int_{-\infty}^\infty g(y) f_{Y}(y)\left(\int_{-\infty}^\infty h(x) f_X(x)\,dx\,\right) dy= \int_{-\infty}^\infty g(y) f_{Y}(y) E(h(X))\, dy\]
\[ = E(h(X))\int_{-\infty}^\infty g(y) f_{Y}(y)\, dy= E(h(X)) E(g(X))\]
Suppose \(X\) and \(Y\) are jointly discrete with joint pmf:
| \(y\) | \(x= 0\) | \(x = 1\) | \(x = 2\) |
|---|---|---|---|
| 0 | 1/9 | 2/9 | 1/9 |
| 1 | 2/9 | 2/9 | 0 |
| 2 | 1/9 | 0 | 0 |
Find \(E(XY)\).
\[E(XY) = \sum_{x=0}^2 \sum_{y=0}^2 xy\cdot p(x,y)\]
\[ \begin{align} &= 0^2\cdot \frac{1}{9} + 0\cdot1\cdot \frac{2}{9} + 0\cdot2\cdot \frac{1}{9}\\ &+ 1\cdot 0\cdot \frac{2}{9} + 1^2\cdot \frac{2}{9} + 1\cdot 2\cdot 0\\ &+ 2\cdot 0 \cdot\frac{1}{9} + 2\cdot 1 \cdot 0 + 2\cdot 2\cdot 0 \end{align}\]
\[ = \frac{2}{9}\]
Find \(E(X-Y)\) using joint pmf.
| \(y\) | \(x= 0\) | \(x = 1\) | \(x = 2\) |
|---|---|---|---|
| 0 | 1/9 | 2/9 | 1/9 |
| 1 | 2/9 | 2/9 | 0 |
| 2 | 1/9 | 0 | 0 |
\[E(X-Y) = \sum_{x=0}^2 \sum_{y=0}^2 (x-y)\cdot p(x,y)\]
\[ \begin{align} &= (0-0)\cdot \frac{1}{9} + (0-1)\cdot \frac{2}{9} + (0 - 2)\cdot \frac{1}{9}\\ &+ (1- 0)\cdot \frac{2}{9} + (1-1)\cdot \frac{2}{9} + (1- 2)\cdot 0\\ &+ (2- 0) \cdot\frac{1}{9} + (2- 1) \cdot 0 + (2-2)\cdot 0 = 0 \end{align} \]
Find \(E(X-Y)\) using marginals and linearity.
| \(y\) | \(x= 0\) | \(x = 1\) | \(x = 2\) |
|---|---|---|---|
| 0 | 1/9 | 2/9 | 1/9 |
| 1 | 2/9 | 2/9 | 0 |
| 2 | 1/9 | 0 | 0 |
| \(y\) | \(p_Y(y)\) |
|---|---|
| 0 | 4/9 |
| 1 | 4/9 |
| 2 | 1/9 |
\(E(Y) = 0\cdot 4/9 + 1\cdot 4/9 + 2 \cdot 1/9 = 6/9\)
| \(x\) | 0 | 1 | 2 |
|---|---|---|---|
| \(p_X(x)\) | 4/9 | 4/9 | 1/9 |
\(E(X) = 0\cdot 4/9 + 2\cdot 4/9 + 2\cdot 1/9 = 6/9\)
\[E(X-Y) = E(X)-E(Y) = 6/9-6/9 = 0\]
Suppose \(X\) and \(Y\) are jointly continuous with joint pdf:
\[f(x,y) = \begin{cases}3x & 0 < y < x < 1 \\ 0 & otherwise \end{cases}\]
Joint support:
Find \(E(XY)\).
\[E(XY) = \int_0^1\int_0^x xy \cdot 3x \, dy\,dx\]
\[\int_0^1\int_0^x 3x^2 y \, dy\,dx = \int_0^1\left(\frac{3}{2}x^2y^2\big|_{y=0}^x\right)\,dx\]
\[= \int_0^1\frac{3}{2}x^4\,dx = \frac{3}{10}\]
Approach 1, directly using joint:
\[f(x,y) = f_X(x)f_Y(y) = \begin{cases}1 & 1 \le x \le 2, 1 \le y \le 2 \\ 0 & otherwise \\ \end{cases}\]
\[E\left(\frac{X}{Y}\right) = \int_1^2 \int_1^2 \frac{x}{y} \cdot 1 \, dx\,dy\]
\[= \int_1^2 \left(\frac{x^2}{2y}\big|_{x=1}^2\right)\,dy = \int_1^2\frac{3}{2y}\,dy \]
\[= \frac{3}{2}\ln(y)\big|_{y=1}^2 = \frac{3}{2}\ln(2)\]
Approach 2, use Properties 3-4:
\[E\left(\frac{X}{Y}\right) = E(X)E\left(\frac{1}{Y}\right)\]
\[E\left(\frac{1}{Y}\right) = \int_1^2 \frac{1}{y} \cdot 1 \,dy = \ln(y)\big|_1^2 = \ln(2)\]
\[E(X) = \frac{3}{2}, \] using property of uniforms.
\(\Rightarrow E\left(\frac{X}{Y}\right) = \frac{3}{2}\ln(2)\)
Covariance measures how much \(X\) and \(Y\) vary together, and is defined as an expectation of a function.
\[Cov(X,Y) = E\left[(X-E(X))(Y-E(Y))\right] = E\left[(X-\mu_X)(Y-\mu_Y)\right],\]
where \(E(X) = \mu_X\), \(E(Y) = \mu_Y\)
\[Cov(X,Y) = E(XY)-E(X)E(Y) = E(XY)-\mu_X\mu_Y\]
Proof:
\[Cov(X,Y) = E\left[(X-\mu_X)(Y-\mu_Y)\right] = E\left[XY-X\mu_Y-Y\mu_X + \mu_X \mu_Y\right]\]
\[ = E(XY)-E(X\mu_Y)-E(Y\mu_X) + E(\mu_X \mu_Y)\]
\[ = E(XY)-\mu_YE(X)-\mu_XE(Y) + \mu_X \mu_Y\]
\[ = E(XY)-\mu_Y\mu_X-\mu_X\mu_Y + \mu_X \mu_Y = E(XY)-\mu_X\mu_Y\]
Proof:
\[Cov(X,Y) = E(XY)-E(X)E(Y) = E(X)E(Y)-E(X)E(Y) = 0\]
df1 and df2.\[\rho = Cor(X,Y) = \frac{Cov(X,Y)}{\sqrt{Var(X)Var(Y)}} = \frac{Cov(X,Y)}{\sigma_X\sigma_Y}\]
\[\hat{\rho} = \frac{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)(y_i - \bar y)}{\sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)^2\frac{1}{n-1}\sum_{i=1}^n(y_i-\bar y)^2}}\]
\(X\) and \(Y\) are jointly continuous random variables with joint pdf:
\[f(x, y) = \begin{cases} 6(1-y), & 0 \le x \le y \le1 \\ 0, & \text{otherwise} \end{cases}\]
Marginals:
Find \(Cov(X,Y)\).
\(X\) and \(Y\) are jointly continuous random variables with joint pdf:
\[f(x, y) = \begin{cases} 6(1-y), & 0 \le x \le y \le1 \\ 0, & \text{otherwise} \end{cases}\]
Marginals:
Find \(Cor(X,Y)\).