[R] Non-positive definite cross-covariance matrices

Mike Marchywka marchywka at hotmail.com
Wed Nov 17 03:58:05 CET 2010

> Date: Tue, 16 Nov 2010 17:39:57 -0800
> From: peter.langfelder at gmail.com
> To: jbassett at cs.gmu.edu
> CC: r-help at r-project.org
> Subject: Re: [R] Non-positive definite cross-covariance matrices
> > 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.
> Hi Jeff,
> 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.
Do you have a link to a paper on what you are trying to do?
It is quite common in many related expressions 
to have quadratic terms and then get cross terms that don't act the same way. 
The elements of A and B are ordered numbers right rather than codes
for bases? 

Are these the formula you are talking about? 
With scalars order not matter 


usually you expect matricies to be about the same and often
are for many special cases ( usually things like AB=BA etc) . 
In this case, if you
look at the defintions, it seems the cross terms differ just 
in being transpose of each other,


Positive-sort-of-definite would seem to imply something
about the data. I guess one question might be that
given what you think this thing measures and given
what you think your data is, should it have some
properties like being positive? What does positive
mean in the system under consideration? 

> Peter
> Peter
> ______________________________________________
> R-help at 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.

More information about the R-help mailing list