00:01
We have a joint distribution here, and we want to find the covariance of x and y and the correlation of x and y.
00:10
So, covariance and the correlation of x and y.
00:16
And to get the correlation, we take the covariance of x and y, divided by the standard deviations of x and x and the standard deviation of y multiplied together.
00:29
That's the correlation, so we need the covariance.
00:32
The covariance, we're going to use this function for, this formula, expected value of x times y minus the expected value of x times the expected value of y.
00:44
And these two, expected value of x and expected value of y, these are also the means.
00:48
You might see it like this, mu of x, mu of y, something like that.
00:52
So let's start with the expected value of x and y.
00:57
So to get that, what we do is we take the sum of all the x, x times p of x values.
01:06
And we're doing this because it's discrete.
01:08
If it's continuous, you would take an integral.
01:09
But here it's not.
01:11
And then we do this to do the expected value of y.
01:13
It's the exact same thing except it be y.
01:16
Instead of x.
01:21
As i wrote y right here, or i wrote x right there.
01:24
There we go.
01:25
So we need basically to find the marginal distributions of x and y.
01:31
And you get that by summing up the rows and columns.
01:35
So here is the probability of x.
01:38
You sum across the row for 0 .21, row for 5, you get 0 .47, row for 10, you get 0 .32.
01:45
For y, you sum the columns.
01:48
0 .08 for 0 .0, 0 .3 for 5, 0 .37 for 10, and 0 .21 for 15.
01:55
So those are distributions.
01:57
And then to get the means, the whole thing here, so you take each x and y value, right, 0, or in this case, they both have a 0, multiplied by their respective probabilities, 0 times 0 .0 .0 .5 .7, and so on and so forth.
02:21
And then you sum up these values, and that's the mean of y.
02:24
Same thing for x, multiply each x value multiplied by its respective probability.
02:28
You get this column, add them up, you got that.
02:30
So we're almost, we have some of this already.
02:33
Let's move this down.
02:38
So the covariance, we need the expected value of x, y, but we just found expected value of x and y is 5 .55 and 8 .55.
02:51
All right, that's good.
02:52
Now the expected value of xy.
02:54
This one takes a little bit more work, and i'm going to show you that in a second.
02:59
So the expected value of x, y is equal to, similar to the expected value of xy, it's the sum of the product of x and y's multiplied by their joint probabilities.
03:17
So this one i'm going to show you in the spreadsheet what that looks like.
03:22
So here is, this is to calculate the expected value of x, y.
03:27
So here's the joint distribution that we saw earlier.
03:29
Right there, same thing.
03:31
We take the product of x and y.
03:33
So zero times zero is zero.
03:35
Five times zeros.
03:36
All these are zeros.
03:37
These same thing with the zero.
03:38
But five times five is 25.
03:41
Five times ten is 50.
03:43
Five times 15 is 75.
03:44
And you do it for this last row.
03:48
So you get these products of x, y.
03:49
That's what those are.
03:50
And then you take each of these products, multiply by the joint probability.
03:55
So you do .03 multiplied by 0 .04 times zero and well those are all zeros.
04:03
But here you get .13 times 25 you get 3 .25 .15 times 50 you get 7 .5 and so on and so forth.
04:11
And then you get these are all the the product of x and y times the probabilities add them up and that's the expected value of x .y.
04:20
44 .75.
04:27
44 .75.
04:29
Now we calculate that for the covariance.
04:31
And i've done that over here, right there.
04:36
So it's that cell, 44 .75 minus d4 and i -44.
04:42
Those are the expected values...