On Tue, Nov 16, 2010 at 1:49 PM, Peter Langfelder <peter.langfel...@gmail.com> wrote: > > It is easy to come up with examples where Cov(A, B) + Cov(B, A) is not > positive definite. As an extreme example, consider a matrix A (say 10 > columns, 100 rows) such that the off-diagonal covariances are all zero > and the columns are standardized, so cov(A) = diag(1, 1, 1, ...). Then > take B = -A, so cov(A, B) = cov(B, A) = diag(-1, -1, -1, ...). > Obviously, cov(A, B) + cov(B, A) is not positively definite, in fact > it is negative definite.
Peter, I see your point. As it turns out though, what I'm trying to calculate is heritability using a slightly modified version of an equation from multivariate quantitative genetics. Theoretically I suppose a heritability matrix could be non-positive definite, but in practice it almost never is, at least from what I understand. I think I've found a solution to my problem though. The equation I showed before can be rearranged so that the cross-covariance terms are described in terms of the Var() terms. Cov(A, B) + Cov(B, A) = Var(A) + Var(B) - Var(A + B) Since the corpcor package can calculate positive definite versions of all the Var() terms, I can then calculate the sum of the cross-covariance terms from those. I've done some preliminary tests, and it seems to be working quite well. Thanks for all the help, - Jeff ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.