# Re: [R] help computing a covariance

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sat 03 Jul 2004 - 02:17:48 EST

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@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help