[R] Weighted association map

Gabor Grothendieck ggrothendieck at gmail.com
Mon Sep 11 15:18:01 CEST 2006


Great.  In looking at it once more I realize that even the sign(kor)
part could be shortened to just kor in this example.  Regards.

library(sna)
set.seed(123)
kor <- cor(iris[1:4])
gplot(kor, edge.lwd = 10*kor, displaylabels = TRUE, label = rownames(kor))



On 9/11/06, kone <attenka at utu.fi> wrote:
> Sorry to answer so late, but this is just what I want ;-)
>
> -Atte
>
> Gabor Grothendieck kirjoitti 8.9.2006 kello 14.53:
>
> > Actually the discretization does not appear to be needed.  This
> > works just as well:
> >
> > set.seed(123)
> > kor <- cor(iris[1:4])
> > gplot(sign(kor), edge.lwd = 10*kor, displaylabels = TRUE, label =
> > rownames(kor))
> >
> > On 9/8/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> >> Try the sna package.  Below we calculate the
> >> correlation matrix, kor, of the numeric cols of builtin iris
> >> dataset.  Zap negative ones and discretize rest to
> >> get lwd width matrix, lwd, used for edge widths.  From
> >> that create the adjacency matrix, sign(lwd), and plot it
> >> using indicated layout mode.  Seems like three of
> >> the variables are correlated and Sepal.Width is uncorrelated
> >> or negatively correlated to those. Try playing around with
> >> gplot args to create variations.
> >>
> >> library(sna)
> >> set.seed(123) # layout uses random numbers
> >> kor <- cor(iris[1:4])
> >> lwd <- replace(kor, TRUE, 10 * round(pmax(0, kor), 1))
> >> gplot(sign(lwd), edge.lwd = lwd, displaylabels = TRUE, label =
> >> rownames(kor))
> >>
> >> On 9/8/06, kone <attenka at utu.fi> wrote:
> >> > Could somebody program this kind of plot type to R, if none exists,
> >> > based on mds or correlation tables or some more suitable method?
> >> What
> >> > do you think about idea? Does it work? None similar or better
> >> exists?
> >> >
> >> > http://weightedassociationmap.blogspot.com/
> >> >
> >> >
> >> > Atte Tenkanen
> >> > University of Turku, Finland
> >> >
> >> > ______________________________________________
> >> > 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
> >> > and provide commented, minimal, self-contained, reproducible code.
> >> >
> >>
>
>



More information about the R-help mailing list