[Vegan-commits] r2209 - in branches/2.0: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jun 2 12:47:59 CEST 2012
Author: jarioksa
Date: 2012-06-02 12:47:59 +0200 (Sat, 02 Jun 2012)
New Revision: 2209
Modified:
branches/2.0/R/metaMDS.R
branches/2.0/R/monoMDS.R
branches/2.0/R/print.metaMDS.R
branches/2.0/inst/ChangeLog
branches/2.0/man/metaMDS.Rd
branches/2.0/man/monoMDS.Rd
Log:
merge selected commits in 2172 thru 2187: metaMDS warns about too good stress
Modified: branches/2.0/R/metaMDS.R
===================================================================
--- branches/2.0/R/metaMDS.R 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/R/metaMDS.R 2012-06-02 10:47:59 UTC (rev 2209)
@@ -37,6 +37,11 @@
out <- metaMDSiter(dis, k = k, trymax = trymax, trace = trace,
plot = plot, previous.best = previous.best,
engine = engine, ...)
+ ## Nearly zero stress is usually not a good thing but a symptom of
+ ## a problem: you may have insufficient data for NMDS
+ if (out$stress < 1e-3) {
+ warning("Stress is (nearly) zero - you may have insufficient data")
+ }
points <- postMDS(out$points, dis, plot = max(0, plot - 1), ...)
if (is.null(rownames(points)))
rownames(points) <- rownames(comm)
Modified: branches/2.0/R/monoMDS.R
===================================================================
--- branches/2.0/R/monoMDS.R 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/R/monoMDS.R 2012-06-02 10:47:59 UTC (rev 2209)
@@ -89,13 +89,8 @@
iregn <- 3
nobj <- nrow(mat)
}
- ## ndis: number dissimilarities
+ ## ndis: number of >0 dissimilarities (distinct points)
ndis <- length(dist)
- ## some people try to use NMDS with too few points and too many
- ## dimensions
- if (ndis <= k * nobj)
- stop(gettextf("Not enough data for NMDS: you have %d dissimilarities,\n and you ask %d scores (%d dimensions times %d points)",
- ndis, k * nobj, k, nobj))
## starting configuration
if (missing(y)) {
y <- matrix(runif(nobj*k, -1, 1), nobj, k)
Modified: branches/2.0/R/print.metaMDS.R
===================================================================
--- branches/2.0/R/print.metaMDS.R 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/R/print.metaMDS.R 2012-06-02 10:47:59 UTC (rev 2209)
@@ -17,11 +17,13 @@
cat(", ", c("weak", "strong")[x$ities], " ties", sep = "")
cat("\n")
}
- if (x$converged)
+ if (x$converged) {
cat("Two convergent solutions found after", x$tries,
"tries\n")
- else cat("No convergent solutions - best solution after",
- x$tries, "tries\n")
+ } else {
+ cat("No convergent solutions - best solution after",
+ x$tries, "tries\n")
+ }
z <- x$points
scal <- c(if (attr(z, "centre")) "centring",
if (attr(z, "pc")) "PC rotation",
Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/inst/ChangeLog 2012-06-02 10:47:59 UTC (rev 2209)
@@ -12,6 +12,8 @@
* merge r2178, 2180: ordipointlabel gains 'select' argument.
* merge r2173-2176, 2185: ordihull labels, semintransparent
colours in ordihull & ordiellipse.
+ * merge r2172,2179,2181,2184,2186,2187: metaMDS warns about too
+ good stress.
* merge r2170: bioenv accepts dissimilarities as input.
* merge r2167: warn about unequal aspect ratio in ordiplot3d.
* merge r2162: set equal axis scales for ordiplot3d.
Modified: branches/2.0/man/metaMDS.Rd
===================================================================
--- branches/2.0/man/metaMDS.Rd 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/man/metaMDS.Rd 2012-06-02 10:47:59 UTC (rev 2209)
@@ -54,7 +54,9 @@
In the latter case all other stages are skipped except random
starts and centring and pc rotation of axes. }
\item{distance}{Dissimilarity index used in \code{\link{vegdist}}.}
- \item{k}{Number of dimensions in \code{\link[MASS]{isoMDS}}.}
+ \item{k}{Number of dimensions. NB., the number of points \eqn{n}
+ should be \eqn{n > 2k + 1}{n > 2*k + 1}, and preferably higher in
+ non-metric MDS.}
\item{trymax}{Maximum number of random starts in search of stable
solution.}
Modified: branches/2.0/man/monoMDS.Rd
===================================================================
--- branches/2.0/man/monoMDS.Rd 2012-06-02 05:39:41 UTC (rev 2208)
+++ branches/2.0/man/monoMDS.Rd 2012-06-02 10:47:59 UTC (rev 2209)
@@ -26,7 +26,10 @@
\item{dist}{Input dissimilarities.}
\item{y}{Starting configuration. A random configuration will be
generated if this is missing.}
- \item{k}{Number of dimensions.}
+
+ \item{k}{Number of dimensions. NB., the number of points \eqn{n}
+ should be \eqn{n > 2k + 1}{n > 2*k + 1}, and preferably higher in
+ non-metric MDS.}
\item{model}{MDS model: \code{"global"} is normal non-metric MDS
with a monotone regression, \code{"local"} is non-metric MDS with
More information about the Vegan-commits
mailing list