Hi all, Why cov(y, y) only gives one value, and cov(t(y), t(y)) gives 3x3 NA matrix?
Here my y is listed below and it is a 3x1 matrix. I am expecting that if I have a random vector y=[y1 y2 y3]', here " ' " denotes a transposition so that y is a column vector, where y1, y2, y3 are independent random variables... then cov(y, y) should be E[ y * y' ] - E[y] * E[y] ', and it should generate an 3x3 identity matrix. In fact, as you can see, my y below is generated by y=[f(1)+e1, f(2)+e2, f(3)+e3]', =[ 1^2+e1, 2^2+e2, 3^2+e3]', =[ 1 + e1, 4 + e1, 9 + e1]. where f(x)=x^2, e1, e2, e3 are three independent normal(0, 1) sample values... so I expect the cov(y, y) will be a 3x3 identity matrix. What's wrong here? -------------------------------------------------------- > cov(y, y) [,1] [1,] 13.78024 > cov(t(y), t(y)) [,1] [,2] [,3] [1,] NA NA NA [2,] NA NA NA [3,] NA NA NA > y [,1] [1,] 1.146766 [2,] 5.412608 [3,] 8.542067 [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html