[Rd] MASS: isoMDS and sammon

Prof Brian D Ripley ripley@stats.ox.ac.uk
Sat, 13 Oct 2001 07:52:48 +0100 (BST)


On 13 Oct 2001, Peter Dalgaard BSA wrote:

> Peter Kleiweg <kleiweg@let.rug.nl> writes:
>
> > If tbl is an object of class 'dist', you can do this:
> >
> >     a <- sammon(tbl, k=3)
> >
> >
> > But you can't do this:
> >
> >     b <- isoMDS(tbl, k=3)
> >
> >
> > Wouldn't it be sensible to have identical interfaces to sammon()
> > and isoMDS() ?
> >
> > I think all that would be needed is to change this:
> >
> >   isoMDS <- function(d, y=cmdscale(d, 2), maxit=50, trace=TRUE)
> >   {
> >
> > ...into this:
> >
> >   isoMDS <- function(d, y, k=2, maxit=50, trace=TRUE)
> >   {
> >     if(missing(y)) y <- cmdscale(d, k=k)
>
> Actually, it should work if you simply define the arguments as
>
> isoMDS <- function(d, y=cmdscale(d, k), k=2, maxit=50, trace=TRUE)
>
> Default arguments can refer to each other and even to items calculated
> inside the function.

You don't need to change anything to use dimensions other than 2 (and the
author of pcurve didn't realise this either, it seems).

Just call isoMDS with a k-dimensional start, as the help page says.
One reason for not making this easy is that the starting configuration
is critical and often one can do better than the default, particularly in
higher dimensions.  (Use the results of sammon(), for example, whihc is one
reason why they might need different interfaces.)

Both sammon and isoMDS are about 9 years old (predating MASS), and started
life in different S library sections.  I will not change the interfaces now
(and both proposals would break positional matching).  (They have
maxit vs niter too.)

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._