cmdscale calculates an eigenanalysis of the dissimilarity matrix, and
does not employ "stress" per se. Rather, it attempts to maximize
variability along axes.
If you call the the cmdscale() function with "eig=TRUE" it returns a
list object with the coordinates called "points" and the eigenvalues
called "eig". Accordingly, if you have an object returned from
cmdscale
you can look at the dimensionality of the solution with
> x <- cmdscale(dissim.matrix,eig=TRUE)
> barplot(x$eig)
If you really want "stress" you should use the isoMDS() function from
MASS which performs nonmetric multi-dimensional scaling, and does
directly employ stress.
You might also want to look at functions metaMDS in package vegan, and
nmds in package labdsv. There is a page at
http://ecology.msu.montana.edu/labdsv/R/lab7/lab7.html
and
http://ecology.msu.montana.edu/labdsv/R/lab8/lab8.html
that attempts to explain this.
Dave R.
Michelle DePrenger-Levin wrote:> Hello,
>
> We are trying to find a function to compute "stress" in our
> multidimensional scaling analysis of a dissimilarity matrix. We've used
> "dist()" to create the matrix and "cmdscale()" for the
scaling. In order
> to determine the number of dimensions we would like to plot stress vs.
> dimensions. However, we cannot find a pre-made command. It seems that
> other programs may test stress as part of the algorithm as opposed to
> cmdscale() which allows us to chose the number of dimensions. Do we need
> to just code in a computation of stress?
>
> Thanks,
> Michelle
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
>
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David W. Roberts office 406-994-4548
Professor and Head FAX 406-994-3190
Department of Ecology email droberts at montana.edu
Montana State University
Bozeman, MT 59717-3460