I'm looking for someone to explain the difference between these procedures. The function prcomp() does principal components anaylsis, and the function cmdscale() does classical multi-dimensional scaling (also called principal coordinates analysis). My confusion stems from the fact that they give very similar results: my.d <- matrix(rnorm(50), ncol=5) rownames(my.d) <- paste("c", 1:10, sep="") # prcomp prc <- prcomp(my.d) # cmdscale mds <- cmdscale(dist(my.d)) cor(prc$x[,1], mds[,1]) # produces 1 or -1 cor(prc$x[,2], mds[,2]) # produces 1 or -1 Presumably, under the defaults for these commands in R, they carry out the same (or very similar) procedures? Thanks Mick The information contained in this message may be confidentia...{{dropped}}
Michael, Why should that confuse you? Have you tried reading some of the literature on these methods? There's plenty about them on the Net (Wiki's often a goodish place to start)---and even in R, if you're prepared to look ;). BestR, Mark. michael watson (IAH-C) wrote:> > I'm looking for someone to explain the difference between these > procedures. The function prcomp() does principal components anaylsis, > and the function cmdscale() does classical multi-dimensional scaling > (also called principal coordinates analysis). > > My confusion stems from the fact that they give very similar results: > > my.d <- matrix(rnorm(50), ncol=5) > rownames(my.d) <- paste("c", 1:10, sep="") > # prcomp > prc <- prcomp(my.d) > # cmdscale > mds <- cmdscale(dist(my.d)) > cor(prc$x[,1], mds[,1]) # produces 1 or -1 > cor(prc$x[,2], mds[,2]) # produces 1 or -1 > > Presumably, under the defaults for these commands in R, they carry out > the same (or very similar) procedures? > > Thanks > Mick > > The information contained in this message may be confidentia...{{dropped}} > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://www.nabble.com/Difference-between-prcomp-and-cmdscale-tf3920408.html#a11118602 Sent from the R help mailing list archive at Nabble.com.
On Thu, 14 Jun 2007, michael watson (IAH-C) wrote:> I'm looking for someone to explain the difference between these > procedures. The function prcomp() does principal components anaylsis, > and the function cmdscale() does classical multi-dimensional scaling > (also called principal coordinates analysis). > > My confusion stems from the fact that they give very similar results: > > my.d <- matrix(rnorm(50), ncol=5) > rownames(my.d) <- paste("c", 1:10, sep="") > # prcomp > prc <- prcomp(my.d) > # cmdscale > mds <- cmdscale(dist(my.d)) > cor(prc$x[,1], mds[,1]) # produces 1 or -1 > cor(prc$x[,2], mds[,2]) # produces 1 or -1 > > Presumably, under the defaults for these commands in R, they carry out > the same (or very similar) procedures?For Eucldean distance, the same. The point being that classical MDS on Euclidean distances is just PCA on the reconstucted configuration, but that MDS is not restricted to a data matrix. The relationship is explained in MASS, for example.> Thanks > Mick-- 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