[R] graphing of Princomp object

Erik Norvelle erik at norvelle.org
Sun Jan 16 10:11:56 CET 2005


Tobias,

Great, works like a charm!  I'm already seeing all kinds of patterns 
that were invisible before.  I appreciate your help.

-Erik

On 15/01/2005, at 16:30, Tobias Verbeke wrote:

> On Sat, 15 Jan 2005 15:53:18 +0100
> List account <lists at 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 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
>




More information about the R-help mailing list