Hi R-community, I am doing a PCA and I need plots for different combinations of axes (e.g., PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each variables. What I need is exactly what I get using biplot (pca.object) but for other axes. I have plotted PC2 and 3 using the scores of the cases, but I don't get the arrows proportional to the loadings of each variables on each axis. Any hints on this? Thanks, Silvia. -- View this message in context: http://www.nabble.com/plotting-other-axes-for-PCA-tp14952955p14952955.html Sent from the R help mailing list archive at Nabble.com.
On Fri, 18 Jan 2008, Silvia Lomascolo wrote:> > Hi R-community, > I am doing a PCA and I need plots for different combinations of axes (e.g., > PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each > variables. What I need is exactly what I get using biplot (pca.object) but > for other axes.The prcomp and princomp methods of biplot() have argument 'choices' that does exactly what you seem to be asking for.> I have plotted PC2 and 3 using the scores of the cases, but I don't get the > arrows proportional to the loadings of each variables on each axis. > > Any hints on this? > > Thanks, Silvia.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hi Silvia,>> What I need is exactly what I get using biplot (pca.object) but for other >> axes.You need to look at ?biplot.prcomp (argument: choices=) ## Try biplot(prcomp(USArrests), choices=c(1,2)) ## plots ax1 and ax2 biplot(prcomp(USArrests), choices=c(1,3)) ## plots ax1 and ax3 Also look at package ade4 (which in my view still sets the standard in R) ## Example T.pca <- dudi.pca(USArrests, scannf=F, nf=4) scatter(T.pca, clab.r=0.5, clab.c=.8) scatter(T.pca, clab.r=0.5, clab.c=.8, xax=1, yax=3, posie="none") add.scatter.eig(T.pca$eig, T.pca$nf, "bottomright", xax=1, yax=3) ## Exclude row labels scatter(T.pca, clab.r=0, clab.c=.8) HTH, Mark. Silvia Lomascolo wrote:> > Hi R-community, > I am doing a PCA and I need plots for different combinations of axes > (e.g., PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings > of each variables. What I need is exactly what I get using biplot > (pca.object) but for other axes. > > I have plotted PC2 and 3 using the scores of the cases, but I don't get > the arrows proportional to the loadings of each variables on each axis. > > Any hints on this? > > Thanks, Silvia. >-- View this message in context: http://www.nabble.com/plotting-other-axes-for-PCA-tp14952955p14955292.html Sent from the R help mailing list archive at Nabble.com.