00:01
We're given a random vector z and the expected value of z is this column vector 5 4 6 where z 1 is 5 z 2 is 4 z 3 is 6 we have the covariance matrix we'll call v z equals 2 by row 3 2 1 2 2 1 1 1 1 and looking at this piece here.
00:26
This 3 is the variance of z 1 whereas this 2 right here is the covariance of z 2 and z 1 and likewise this 2 is also the covariance of z 1 z 2.
00:38
That's how we read that alright, and we're given some transformations for y y 1 is z 1 plus 2 z 3 y 2 z 1 plus z 2 minus z 3 and y 3 is 2 z 1 plus z 2 plus z 3 minus 5 and the first question we have today is to find the expected value y of each of these y's and also the covariance of the covariance matrix of y's like this to keep the same notation here and we could go over through this piece by piece, but this is where linear algebra is really going to help us out so to find the expected value what we're gonna do expected value y is going to equal b plus a matrix a multiplied by the expected value of z.
01:43
We have the expected value of z here what's a a is based upon these transformations here.
01:47
So we're going to define a the following matrix and i'm gonna do a little notation.
01:56
So looking at the coefficients here the coefficient on z 1 is 1 the coefficient on z 2 is 0 right because we have 3 variables z 1 z 2 and z 3 that we're not having a good on a z 2 here and then the coefficient on the z 3 term is 2 if you keep going through here for y 2 it's 1 1 minus 1 and for y 3 it's 2 1 1 but we have this minus 5 here so we're gonna ignore that for a second.
02:21
So matrix a it's going to be 1 0 2 1 1 1 1 all right.
02:31
Now what do we do this minus 5? that's what this b is that's what b is this little lingering 5 here on the y 3 term.
02:38
So we think about our here's our y 1 here's our y 2 and y 3 we also have to consider b and b is on the y 3 value.
02:47
So it's this column vector here where it's 0 0 5 so we're gonna do this multiplication.
02:57
So we are this matrix multiplication here.
03:00
So we have 0 0 5 plus the a matrix 1 0 2 1 and multiply that by the x by this vector here or 6 all right.
03:28
So then we're gonna get our expected values and here we're gonna use r to do this so here's the code for it.
03:35
Here's the variance vector here's the code for it that and see that's the same covariance matrix before the expected value vector 5 4 6 and a this is that transformation matrix.
03:52
So just be this is the syntax for it in r b is that column vector here? 5 here's the expected value of y b plus a and this is the notation for mixed matrix multiplication and we get 17 3 15 now for the covariance matrix this v y here this it's going to be that same matrix a that we defined earlier a times the variance of z times the transpose of a remember the transpose is just you just you just basically i think about spinning it along the diagonal here, so this is gonna be 1 0 2 let's see so oh yeah, 1 1 2 is calling that row and then we've got 0 1 1 to be this row and then 2 and 1 1 there we go so that's a transpose.
05:14
So we do that multiplication to get our new variance matrix and here it is a matrix multiply v.
05:26
Oops v dot z.
05:27
I called v dot z that matrix t parentheses a that's the transpose and there we go.
05:35
This is our covariance matrix.
05:48
There we go.
05:49
Kind of simplify the writing of it.
05:51
That's it great now the next thing we're gonna do is find the expected value the expected value and covariance matrix of x where x equals y 1 plus y 2 plus 1 minus y 2 so notice here...