Is there an option to draw concentration ellipses in biplots ? It seems really nice to summarize large number of points of each group. Cheers../ Murli
Hi all, you can see in the library(ade4). there is a nice graphical function called ‘s.class’. Example for a principal components analysis: ?s.class data(meaudret) pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 4) # plot row coordinates s.class(pca1$li, meaudret$plan$dat, sub = "Principal Component Analysis",add. p=F,col=c(1,2,3,4),cstar=0) # add principal axes s.arrow(pca1$c1,clabel=0.7,add.p=T) # “… 'scatter.dudi' is a factorial map of individuals and the # projection of the vectors of the canonical basis multiplied by a # constante of rescaling. …” ?scatter.dudi scatter.dudi(pca1,clab.row=0) s.class(pca1$li, meaudret$plan$dat, sub = "Principal Component Analysis",add. p=T,col=c(1,2,3,4), cstar=0) hope this helps, P.BADY Quoting "T. Murlidharan Nair" <nair at sdsc.edu>:> Is there an option to draw concentration ellipses in biplots ? It > seems > really nice to summarize large number of points of each group. > > Cheers../ Murli > > ______________________________________________ > 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 > >--------------------------------------------------------- Pierre BADY <??)))>< Universit?? Claude Bernard Lyon 1 UMR CNRS 5023, LEHF bat Alphonse Forel 43 boulevard du 11 novembre 1918 F-69622 VILLEURBANNE CEDEX FRANCE TEL : +33 (0)4 72 44 62 34 FAX : +33 (0)4 72 43 28 92 MEL : pierre.bady at univ-lyon1.fr http://limnologie.univ-lyon1.fr
On Thu, 2004-11-04 at 22:44, T. Murlidharan Nair wrote:> Is there an option to draw concentration ellipses in biplots ? It seems > really nice to summarize large number of points of each group.Murli, If you mean biplot.prcomp function in stats package, and you want to draw the "concentration ellipses" for row scores, the answer probably is "not easily". Technically, the problem is that arrows for loadings are drawn after labels for rowscores, and the scaling used for drawing row scores is lost in the process. If you try to add points or segments to the existing plots, you should use the scaling for arrows on sides 3 and 4 (top and right). If you want to add something for row scores, you just don't have information on co-ordinates. I didn't check biplot.princomp, but the situation may be similar there. Drawing of ellipsoids is possible in some alternative packages. You already got a hint of ade4. In addition, vegan has pca as a special case of its rda function, and there you have tools like ordiellipse (using the ellipse package), ordispider and ordihull to display the variability within factor levels. However, vegan doesn't have biplots like biplot.prcomp, i.e. with arrows for loadings, Moreover, scaling of results is different. It seems that the only thing you can do is to write your sweet on biplot function. cheers, jari oksanen -- Jari Oksanen -- Oulu, Finland. "But, Mousie, thou art no thy lane, In proving foresight may be vain; The best-laid schemes o' mice an 'men, Gang aft agley, An'lea'e us nought but grief an' pain, For promis'd joy!" (Robert Burns)