# Re: [R] making matrix monotonous

From: Michael Friendly <friendly_at_yorku.ca>
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

@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@7d4.com wrote:

```>>      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
```

>
>
>
> 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
>
> Vincent
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
>
```--
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