[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] graphing of Princomp object
From:       Tobias Verbeke <tobias.verbeke () telenet ! be>
Date:       2005-01-15 15:30:15
Message-ID: 20050115153015.186bd638.tobias.verbeke () telenet ! be
[Download RAW message or body]

On Sat, 15 Jan 2005 15:53:18 +0100
List account <lists@norvelle.org> wrote:

> Thanks, Tobias for the response.
> 
> I tried the suggestion you gave, and apparently (at least according to 
> the biplot manpage, only the first two members of the col vector are 
> used, the first to plot the first set of values, i.e. the scores, and 
> the second color is used for the loadings (I think I have that right).  
> At any rate, if I add the clause 'col = c(rep("red", 100), rep("blue", 
> 17), rep("green", 62))' I just get a bunch of red points! :(

You're right. I'm sorry I did not read ?biplot, but only checked it had
a col argument (Semel in anno licet insanire..). 
Anyway, with PCA it is not a good idea to plot both variables and
cases on one single plot, because the temptation is too great to interpret
proximities between variables and cases. You'd better plot two different
graphs, one for the cases and one for the `circle of correlations'.

For plotting the cases, you could make up your own plot using
something similar to this:

library(MASS) # for eqscplot
F1 <- yourpca$score[,1]
F2 <- yourpca$score[,2]
eqscplot(F1, F2, pch = 20)
text(F1, F2, labels = names(F1), 
     col = c(rep("red", 100), 
             rep("blue", 17), 
             rep("green", 62)),
     pos = 3)


Tobias

> Si vales, valeo...
> 
> -Erik

______________________________________________
R-help@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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic