Re: [R] making matrix monotonous

From: Michael Friendly <>
Date: Wed 07 Jun 2006 - 22:54:41 EST

[Presuming you mean monotone; many matrices are already monotonous.]

General solutions to this problem are discussed in


   author = {M. Friendly},
   title = {Corrgrams: Exploratory displays for correlation matrices},    journal = {The American Statistician},    year = {2002},
   volume = {56},
   pages = {316--324},
   number = {4},
   url = {}, }
and implemented (in SAS)

Rather than just the first principal component, it is usually better to order the variables by the angles between the first 2 PC, corresponding to their order around a 2D biplot, using sort(atan(V2/V1))

-Michael wrote:

> Spencer Graves a écrit :

>>      I agree it would be great to sort the variables in a correlation 
>>matrix to make it easier to read and see patterns.  I don't know any 
>>functions for doing that.  If it were my problem, I might "order" the 
>>variables by their first principal component.  There may also be some 
>>cluster analysis way to do that, but I don't know it well enough to say.
>>      Hope this helps.
>>      Spencer Graves

> Thanks for your answer Spencer.
> Here is a first result of a very simple and naive approach.
> Of course, there is no assumption the sorting is "optimal",
> but on this little example it helps the matrix being
> more readable.
> Vincent
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street
Toronto, ONT  M3J 1P3 CANADA

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Wed Jun 07 23:05:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 08 Jun 2006 - 00:10:26 EST.

Mailing list information is available at Please read the posting guide before posting to the list.