[R] making matrix monotonous

Michael Friendly friendly at yorku.ca
Wed Jun 7 14:54:41 CEST 2006


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

General solutions to this problem are discussed in

@ARTICLE{Friendly:02:corrgram,
   author = {M. Friendly},
   title = {Corrgrams: Exploratory displays for correlation matrices},
   journal = {The American Statistician},
   year = {2002},
   volume = {56},
   pages = {316--324},
   number = {4},
   url = {http://www.math.yorku.ca/SCS/Papers/corrgram.pdf},
}
and implemented (in SAS)
http://www.math.yorku.ca/SCS/sasmac/corrgram.html

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



vincent at 7d4.com 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.
> http://7d4.com/r/
> 
> Of course, there is no assumption the sorting is "optimal",
> but on this little example it helps the matrix being
> more readable.
> 
> Vincent
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
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    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list