# Expected Value of dependent random Variables

1. Jul 31, 2013

### joemama69

1. The problem statement, all variables and given/known data

We are given the following table and need to find the E(XY)

X|Y y = 17 20 23 35 48 p(x)
x = -20 0.02 0.03 0.07 0.02 0.06 0.2
0 0 0.05 0 0.05 0.1 0.2
1 0.05 0.03 0.02 0.07 0.03 0.2
3 0.01 0.02 0.03 0 0.04 0.1
17 0.18 0.04 0.06 0.01 0.01 0.3
p(y) 0.26 0.17 0.18 0.15 0.24 1

2. Relevant equations

3. The attempt at a solution

So it is clear to me that X & Y are dependent..

E(XY)=SUM_x SUM_y (xyp(x,y)) = -20(17)(.02)+(-20)(20)(.03)... and so on n so forth... is this correct?

2. Jul 31, 2013

### Ray Vickson

Certainly the formula E(XY) = sum_{x,y} p(x,y) x*y is correct (basically, it is the definition of E(XY)); however, whether or not your numbers are correct is impossible to say, because your table is formatted so badly it is unreadable. You should use tabs, etc., and choose a fixed-width font (such as courier new) for the table. You can do this by selecting the table using the mouse, then go to the "Fonts" menu on the top panel Alternatively, you can use the "tabular" environment in LaTeX/TeX and format your table that way. On-line tutorials will show you how to do it. See, eg., http://www1.maths.leeds.ac.uk/latex/TableHelp1.pdf or
http://www.andy-roberts.net/writing/latex/tables .

Last edited: Jul 31, 2013
3. Jul 31, 2013

### joemama69

Whoops, it looks good in the editor but not once posted, didn't realize that, sorry.

That table syntax looks a little confusing... I attached a PDF of all my work. I'm not to confident with my application of the equations. The dependence kind of threw me a bit.

#### Attached Files:

• ###### Document1.pdf
File size:
44.2 KB
Views:
58
4. Jul 31, 2013

### LCKurtz

Try code tags around your data to preserve spacing like I did above. You probably need to massage it some yet though.

5. Jul 31, 2013

### Ray Vickson

How does one insert code tags?

6. Jul 31, 2013

### joemama69

Are you able to use my pdf file w/ my work on it or do I need to retype it in here?

7. Jul 31, 2013

### LCKurtz

Just type [ code]
Type your table or text or whatever here. Spaces and line breaks
will be preserved.
[/ code]

I put an extra space in both tags so it wouldn't actually do it. Type the tags without the spaces and the results will look like what you type as in
Code (Text):

1  2  3
24 25 26

You may still have to tweak it by counting spaces. But see my next post for a better way.

Last edited: Aug 1, 2013
8. Jul 31, 2013

### LCKurtz

You can actually make a nice table with TeX. Here's one I did an another thread:
$$\begin{array}{|c|c|c|c|c|c|} \hline Q_1Q_2Q_3& J_1=\bar Q_2& K_1= 1& J_2=\bar Q_3& K_2=Q_3& J_3=Q_1& K_3=Q_1\\ \hline 000&1&1&1&0&0&0 \\ \hline 110&&&&&& \\ \hline &&&&&& \\ \hline &&&&&& \\ \hline \end{array}$$Feel free to copy/paste and change it.

9. Aug 1, 2013

### Ray Vickson

Thank you for the above.

10. Aug 1, 2013

### joemama69

Code (Text):

X|Y y = 17  20  23  35  48  p(x)
x = -20 0.02    0.03    0.07    0.02    0.06    0.2
0   0   0.05    0   0.05    0.1 0.2
1   0.05    0.03    0.02    0.07    0.03    0.2
3   0.01    0.02    0.03    0   0.04    0.1
17  0.18    0.04    0.06    0.01    0.01    0.3
p(y)    0.26    0.17    0.18    0.15    0.24    1

Ok got it, that code trick made it simple thank you... soo back to the problem at hand...

E(X)=∑x p(x)=-20(0.2)+1(0.2)+3(0.1)+17(0.3)=1.6

E(Y)=∑y p(y)=17(0.26)+20(0.17)+23(0.18)+35(0.15)+48(0.24)=28.73

V(X)=∑(x-E(X))^2 p(x)=

=0.2(-20-1.6)^2+0.2(0-1.6)^2+0.2(1-1.6)^2+0.1(3-1.6)^2

+0.3(17-1.6)^2= 165.24

V(Y)=∑(y-E(Y))^2 p(y)=

=0.26(17-28.73)^2+0.17(20-28.73)^2+0.18(23-28.73)^2

+0.15(35-28.73)^2+0.24(48-28.73)^2=149.6571

E(XY)=∑_x∑_y xyp(x,y)

=(-20)(17)(0.02)+(-20)(20)(0.03)+(-20)(23)(0.07)+(-20)(35)(0.02)

+(-20)(48)(0.06)+17(0.05)+20(0.03)+35(0.07)+48(0.03)+3(17)(0.01)

+3(20)(0.02)+3(23)(0.03)+3(48)(0.04)+17(17)(0.18)+17(20)(0.04)

+17(23)(0.06)+17(35)(0.01)+17(48)(0.04)=-4.07

E(X│Y=23)=∑xp(x│y=23)=∑xp(x,y=23)/p(y=23)

=1/0.18(-20(0.07)+0.02+3(0.03)+17(0.06)=-1.5

V(X│Y=23)=E(X-E(X│Y=23))^2=(1.6+1.5)^2=9.61

E(Y│X=-20)=∑yp(y│x=-20)=∑(yp(y,x=-20)/p(x=-20)

= 1/0.2 (17(0.02)+20(0.03)+23(0.07)+35(0.02)+48(0.06))=30.65

V(Y│X=-20)=E(Y-E(Y│X=-20))^2=(28.73-30.65)^2=3.6864

P(X<3,Y≤23)=0.02+0.03+0.07+0.05+0.05+0.03+0.02=0.27

Does it appear that I have used the formulas correctly???

Last edited: Aug 1, 2013
11. Aug 1, 2013

### Ray Vickson

The calculation inputs look OK, but I have not done the computations to check the answers.

BTW: a much easier way to calculate variance is $\text{Var}(X) = E(X^2) - (EX)^2,$ so if you compute $E(X^2)$ at the same time as $EX$ you will be almost done. As a useful exercise, you should actually verify this; viz., that
$$\sum_{x_i} p(x_i) (x_i - EX)^2 = \sum_{x_i} p(x_i) x_i^2 - (EX)^2,$$
where
$$EX = \sum_{x_i} p(x_i) x_i.$$

12. Aug 1, 2013

### joemama69

Ya we had to verify that in a HW assignment a week or two ago.

I used excel to do all the tedious computations, I was more worried about my set up than the arithmetic.

So for Variance with conditional probabilities I have..

V(X|Y)=E(X-E(X|Y))^2 = (E(X)-E(X|Y))^2 ... is this correct?

13. Aug 1, 2013

### Ray Vickson

No, it is not, and I cannot figure out why you would think it! You get V(X|Y=y) by using the formulas for Var(X), but with p(x) replaced by p_y(x) = Pr(x|Y=y). Note that p_y(x) is a genuine probability distribution over x; it is >= 0, and its sum over all x is 1.

14. Aug 1, 2013

### joemama69

Ya my professor used that notation but Im not suing it correctly... Guess back to the way I know.

V(X│Y=23)=∑(x-E(X|Y=23))^2 p(x|y=23)=(-20+1.5)^2 (0.07/0.18)+(1+1.5)^2 (0.02/0.18)+(3+1.5)^2 (0.03/0.18)+(17+1.5)^2 (0.06/0.18)=1

Am I applying p(x|y) correctly. If I am then I must of done it wrong when I calculated E(X|Y=23)