On Tue, 2009-10-06 at 11:03 +0200, Kim Vanselow wrote: > Dear R-community, dear Jari Oksanen! > I use metaMDS (package vegan) to calculate NMDS. > In a lot of papers I read that it is recommended to use previous best > solutions as a new starting configuration to get better results and to avoid > local minima. > On the help page I found that a previous.best-command is already implemented > in metaMDS: > metaMDS(comm, distance = "bray", ...,plot = FALSE, previous.best,...) > But unfortunately I did not manage to use it properly. > When I run metaMDS without command previous.best I certainly get a result. > I run it again with command previous.best and I get this message: > "Fehler in metaMDS(data... : > object "previous.best" not found" > My question: How can I save the best solution and use it in the next NMDS. > > I also tried to type in the command: previous.best = TRUE > Then I get the message: > "Starting from a previous solution > Fehler in s0$stress : $ operator is invalid for atomic vectors" > > Could you please help me? > Thank you very much, > Kim
That argument allows you to pass metaMDS the results of a previous call to metaMDS, such that the function compares the new set of random starts to the previously achieved best solution. For example; require(vegan) data(dune) set.seed(123) sol <- metaMDS(dune) sol <- metaMDS(dune, previous.best = sol) For this example, the first call to metaMDS converges to the same solution twice within 5 iterations. The second call to metaMDS tells it to compare with the solution found from the first call. A single iteration is required to find a solution that is effectively the same as the solution from the first call. Note how this feature is used; we save the results of the metaMDS function in object 'sol'. We then supply this object to the argument 'previous.best' on our subsequent call to metaMDS. Does that help? The example in ?metaMDS is quite terse and only covers the basic usage. I'll see about adding some further examples to it for future versions. G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@r-project.org 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.