Re: [R] How to plot PCA output?

2012-05-08 Thread S Ellison
-Original Message- I avoid the biplot at all costs, because IMHO it violates one of the tenets of good graphic design: It has two entirely different scales on axes. These are maximally confusing to the end-user. So I never use it. I think you're being unnecessarily

Re: [R] How to plot PCA output?

2012-05-08 Thread Fang
I think the question on your mind should be: 'what do I want to do with this plot'? Just producing output from the PCA is easy - plotting the output$sd is probably quite informative. From the sounds of it, though, you want to do clustering with the PCA component loadings? (Since that's mostly what

Re: [R] How to plot PCA output?

2012-05-08 Thread Bryan Hanson
[...] But having indicated that I don't see a biplot's multiple scales as particularly likely to confuse or mislead, I'm always interested in alternatives. The interesting question is 'given the same objective - a qualitative indication of which variables have most influenced the location

[R] How to plot PCA output?

2012-05-07 Thread Christian Cole
I have a decent sized matrix (36 x 11,000) that I have preformed a PCA on with prcomp(), but due to the large number of variables I can't plot the result with biplot(). How else can I plot the PCA output? I tried posting this before, but got no responses so I'm trying again. Surely this is a

Re: [R] How to plot PCA output?

2012-05-07 Thread Jessica Streicher
That depends on what you want to plot there. Basically, you could just use plot() with pcaResult$x. You might need to define which PCs you want to plot there though. pcaResult-prcomp(iris[,1:4]) plot(pcaResult$x) # gives the first 2 PCs plot(pcaResult$x[,2:3]) #gives the second vs the 3rd PC

Re: [R] How to plot PCA output?

2012-05-07 Thread Jessica Streicher
To add: If thats not it, maybe you could be a bit more specific about what you consider the result, and how you want it visualized. Am 07.05.2012 um 15:24 schrieb Jessica Streicher: That depends on what you want to plot there. Basically, you could just use plot() with pcaResult$x. You might

Re: [R] How to plot PCA output?

2012-05-07 Thread Bryan Hanson
Christian, is that 36 samples x 11K variables? Sounds like it. Is this spectroscopic data? In any case, the scores are in the list element $x as follows: answer - prcomp(your matrix) answer$x contains the scores, so if you want to plot the 1st 2 pcs, you could do plot(answer$x[,1],

Re: [R] How to plot PCA output?

2012-05-07 Thread Jessica Streicher
Biplot, depending on what parameters you give it, scales the data in a certain way. See http://stat.ethz.ch/R-manual/R-patched/library/stats/html/biplot.princomp.html scale The variables are scaled by lambda ^ scale and the observations are scaled by lambda ^ (1-scale) where lambda are the

Re: [R] How to plot PCA output?

2012-05-07 Thread Jessica Streicher
And i always forget the question.. I haven't understood biplots a 100%, but from what i gleaned this scaling is done so it looks better/is easier to read, while the scaling retains certain properties of the biplot (something about projecting). If you want to use the data for anything else, i

Re: [R] How to plot PCA output?

2012-05-07 Thread Bryan Hanson
I don't know the answer, Jessica gave some insight. I avoid the biplot at all costs, because IMHO it violates one of the tenets of good graphic design: It has two entirely different scales on axes. These are maximally confusing to the end-user. So I never use it. If it is gene expression

Re: [R] How to plot PCA output?

2012-05-07 Thread Christian Cole
Hi Bryan, Many thanks for the replies. The data is gene expression data for 36 samples over 11k genes. I see that I can plot PC1 vs PC2 by using $x, but compared to biplot() I can see that the range of values are different. For example, if I use plot() the PC1 scale ranges from -150 to 150

Re: [R] How to plot PCA output?

2012-05-07 Thread Christian Cole
Hi Jessica, THanks for pointing that out. The scaling in biplot() doesn't seem to make sense to me, however. The default value for scale=1 therefore lambda ^ (1-scale) - lambda ^ 0 which is 1 regardless of what lambda is. Which can't be right? Anyway, I won't worry about it anymore as you and

Re: [R] How to plot PCA output?

2012-05-07 Thread Christian Cole
Hi Jessica, Yes, that does help. It confirms my digging around in the prcomp object. I was plotting $x, but wasn't sure whether this was appropriate. Mainly because the data ranges are different in $x than when plotted by biplot() - as I mentioned my reply to Bryan. Do you know if this

Re: [R] How to plot PCA output?

2012-05-07 Thread Christian Cole
Hi Bryan, On 07/05/2012 15:33, Bryan Hanson han...@depauw.edu wrote: I don't know the answer, Jessica gave some insight. I avoid the biplot at all costs, because IMHO it violates one of the tenets of good graphic design: It has two entirely different scales on axes. These are maximally