[R] Non-positive definite cross-covariance matrices
peter.langfelder at gmail.com
Wed Nov 17 02:39:57 CET 2010
> 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.
well, if it works for you, then use it (note that the right hand side
of the equation should have reversed sign), although I have to say
it's not clear to me how the rearrangement helps. Even if all three
variance matrices are positive definite, their sum need not be.
More information about the R-help