[R] How can I remove one of variables which both variables have correlation coefficient more than 0.95 randomly?

bbslover dluthm at yeah.net
Fri Nov 20 18:25:03 CET 2009


http://old.nabble.com/file/p26443595/Edragonr.txt Edragonr.txt 
HI all,

    I have a 72*495 matrix, and the first column is the response, and the
remaining are independences. Final I want to select some independence to fit
y, but there are so many independences, the fit result is not meaning, so I
want to reduce the independece,now. Which method or R package or algorithms
in R package can deal with this problem?

next question, firstly, I want to check the pair correlation coeficient,and
want to  remove one of variables which both variables have correlation
coefficient more than 0.95 randomly?  NOTE, This is random. Before I write a
programe that can delete correlation variable onlly the first variable, It
is not scientific.so I hope all friends can help me write a programe to,
randomly,remove one of variables which both variables have correlation
coefficient more than 0.95 ?  At last, I use those selected variables to fit
y, and hope the regression result is beter with correlation coefficient (r2)
more than 0.7  at less.

n<-0
for(i in 1:(dim.cor[1]-1)) 
{ 
  for(j in (i+1):(dim.cor[2]))
   { 
      if (mat3.cor[i,j]>=0.90) 
      { 
          mat3<-mat3[,-(i-n)] 
          n<-n+1
          break 
      } 
    } 
}       this is my code,but it is not scientific like I said above.

And I upload my file.  Hoping all friends can help me.
-- 
View this message in context: http://old.nabble.com/How-can-I-remove-one-of-variables-which-both-variables-have-correlation-coefficient-more-than-0.95-randomly--tp26443595p26443595.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list