# [R] help computing a covariance

Eugene Salinas (R) r-eugenesalinas at comcast.net
Fri Jul 2 18:33:31 CEST 2004

```Thanks. This is sort of what I have been trying to do... but I keep
ending up with products of non-independent chi-squares where I am sort
of getting stuck. I knew this Theorem just never knew it was called
Cochran's Thm. Btw, do you know of a good book that deals with
multivariate statistics using vector notation etc. All the books I have
seem to be focused on scalar random variables and they don't even
mention it.)

thanks, eugene.

Spencer Graves wrote:

>      Have you considered Cochran's theorem?  (A Google search just
> produce 387 hits for this, the second of which
> "http://mcs.une.edu.au/~stat354/notes/node37.html" provided details
> that might help.)  By construction, P is n x n, idempotent of rank k,
> so y'Py is chi-square(k).  Also, xA is an n-vector in the (rank k)
> column space of x;  indeed, PxA = [x*inv(x'x)*x]xA = xA.  I can't see
> the details now but I believe you can write (A'x'y)^2 = y'xAA'x'y as a
> weighted sum of k independent chi-squares each with one degree of
> freedom (since x and P have rank k), and then get what you want from
> the sum of the weights.  Then check your result using Monte Carlo.
>      hope this helps.  spencer graves
>
> Eugene Salinas (R) wrote:
>
>> Hi everyone,
>>
>> (This is related to my posting on chi-squared from a day ago. I have
>> tried simulating this but I am still unable to calculate it
>> analytically.)
>>
>> Let y be an n times 1 vector of random normal variables mean zero
>> variance 1 and x be an n times k vector of random normal variables
>> mean zero variance 1. x and y are independent.
>>
>> Then P is the projection matrix  P=x*inv(x'*x)*x'
>>
>> I need to figure out the covariance
>>
>> Cov ( y'*P*y , (A'*x'*y)^2 ) where A is a constant of dimension k
>> times 1.
>>
>> thanks, eugene.
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>
>
>
>

```