[R] Difference between prcomp and cmdscale

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu Jun 14 10:33:42 CEST 2007


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}}



More information about the R-help mailing list