You want t(x)%*%x, not t(x)%%x.
Giovanni
> I thought so far, that a covariance matrix is symmetric to the diagonal
> axis?
> I tried:
> x <- matrix(rnorm(5*5), ncol=5)
> > t(x)%%x
> [,1] [,2] [,3] [,4] [,5]
> [1,] 0.0000000 -0.15417309 0.03567755 0.61815453 1.3748462
> [2,] -0.0895276 0.00000000 0.20452335 -0.16291966 -0.6726954
> [3,] -0.4599585 0.02824674 0.00000000 -0.05002809 0.2847527
> [4,] -0.2125452 -0.73217427 -0.11275733 0.00000000 0.4920405
> [5,] 0.3828471 0.10637537 -0.07138546 0.05963281 0.0000000
>
> I may add t(x)%%x + diag(nrow(x))*sd*sd to get a full covariance matrix, but
> would like to mirror the lower triangle matrix to the upper triangle matrix
> before calculating the correlation matrix.
> Any help?
>
> Willi Weber, MD PhD
--
__________________________________________________
[ ]
[ Giovanni Petris GPetris@uark.edu ]
[ Department of Mathematical Sciences ]
[ University of Arkansas - Fayetteville, AR 72701 ]
[ Ph: (501) 575-6324, 575-8630 (fax) ]
[ http://definetti.uark.edu/~gpetris/ ]
[__________________________________________________]
|