Skip to content

Maximally independent variables

4 messages · Jacques VESLOT, Gabor Grothendieck, Charles C. Berry

#
library(gtools)
z <- combinations(ncol(DF), 3)
maxcor <- function(x) max(as.vector(as.dist(cor(DF[,x]))))
names(DF)[z[which.min(apply(z, 1, maxcor)),]]


Gabor Grothendieck a ?crit :
#
That's basically what I already do but what I was wondering
was if there were any other approaches such as connections
with clustering, PCA, that have already been developed in
R that might be applicable.
On 3/1/06, Jacques VESLOT <jacques.veslot at cirad.fr> wrote:
#
In case others are interested I did get a reply offlist
regarding the escouf function in the pastecs package.
See:

   library(pastecs)
   ?escouf

Also see pages 47-52 of
   system.file("doc/pastecs.pdf", package = "pastecs")
(in French).
On 3/1/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
#
Gabor Grothendieck <ggrothendieck <at> gmail.com> writes:
Have you considered finding the combination with maximum generalized variance of
three scaled variables (i.e. the maximum determinant of the correlation matrix
of three variables)?

You can vectorize this calculation as follows:

z <- combinations(ncol(DF), 3)

cormat <- cor(DF)

det3 <- function(ra,rb,rc) 1 - ra*ra - rb*rb - rc*rc + 2*ra*rb*rc

res <- det3( cormat[z[,1:2]],cormat[z[,c(1,3)]],cormat[z[,c(2,3)]] )

z[which.max(res),]
[rest deleted]