Re: [R] Select set of variables with strongest correlation

2009-07-21 Thread nyk
Thanks, I did! This reply I also got helped a lot: r<-matrix(rnorm(30),ncol=3) r4 <-1+2*rnorm(10,r[,3], 0.5) r5 <-1-3*rnorm(10,r[,3], 0.5) data<-cbind(r,r4,r5) corr<-cor(data,use='na.or.complete') corrl<-(corr[col(corr)>row(corr)])^2 colms<-col(data)[col(col(data))>row(col(data))] rows<-row(data

Re: [R] Select set of variables with strongest correlation

2009-07-20 Thread Uwe Ligges
See ?cor Uwe Ligges nyk wrote: What would be a good method to find the subset of columns of a data matrix (with about 200 rows and columns) that has the strongest correlation to one other column? I tried testing sub-matrices with random sets of 10 columns selected using lm(x ~submtrx) and comp

[R] Select set of variables with strongest correlation

2009-07-15 Thread nyk
What would be a good method to find the subset of columns of a data matrix (with about 200 rows and columns) that has the strongest correlation to one other column? I tried testing sub-matrices with random sets of 10 columns selected using lm(x ~submtrx) and comparing the r^2 values. But isn't the