[Vegan-commits] r1669 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 1 15:47:11 CEST 2011


Author: jarioksa
Date: 2011-07-01 15:47:10 +0200 (Fri, 01 Jul 2011)
New Revision: 1669

Modified:
   pkg/vegan/R/stressplot.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/goodness.metaMDS.Rd
   pkg/vegan/man/monoMDS.Rd
Log:
stressplot updates and explain relation of linear fit and stress-2

Modified: pkg/vegan/R/stressplot.R
===================================================================
--- pkg/vegan/R/stressplot.R	2011-07-01 12:38:01 UTC (rev 1668)
+++ pkg/vegan/R/stressplot.R	2011-07-01 13:47:10 UTC (rev 1669)
@@ -47,6 +47,12 @@
             lines(x[k], yf[k], type = "S", col = l.col, lwd = lwd, ...)
         }
     }
+    ## Stress as R2
+    rstress <- 1 - object$stress^2
+    ralscal <- cor(y, yf)^2
+    lab <- paste("Non-metric fit, R2 =", format(rstress, digits=3),
+                 "\nLinear fit, R2 =", format(ralscal, digits=3))
+    text(min(x), 0.95*max(y), lab, pos=4)
     invisible(list("x" = x, "y" = y, "yf" = yf))
 }
     

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-07-01 12:38:01 UTC (rev 1668)
+++ pkg/vegan/inst/ChangeLog	2011-07-01 13:47:10 UTC (rev 1669)
@@ -19,7 +19,9 @@
 
 	* monoMDS: text for a proper help (Rd file). Other help files
 	updated for monoMDS. Stress type 2 is printed both in monoMDS and
-	metaMDS. 
+	metaMDS. stressplot() prints now R2 for monoMDS() results, and
+	docs tell that "linear fit" of stressplot() is related to "stress
+	2". 
 
 Version 1.18-33 (closed June 21, 2011)
 

Modified: pkg/vegan/man/goodness.metaMDS.Rd
===================================================================
--- pkg/vegan/man/goodness.metaMDS.Rd	2011-07-01 12:38:01 UTC (rev 1668)
+++ pkg/vegan/man/goodness.metaMDS.Rd	2011-07-01 13:47:10 UTC (rev 1669)
@@ -38,9 +38,11 @@
   plot of ordination distances and monotone or linear fit line against
   original dissimilarities.  In addition, it adds to the graph two
   correlation-like statistics on the goodness of fit.  The nonmetric
-  fit is based on stress \eqn{S} and defined as
-  \eqn{\sqrt{1-S^2}}{sqrt(1-S^2)}.  The \dQuote{linear fit} is the
-  correlation between fitted values and ordination distances.
+  fit is based on stress \eqn{S} and defined as \eqn{R^2 = 1-S^2}{R2 =
+  1-S*S}.  The \dQuote{linear fit} is the squared correlation between
+  fitted values and ordination distances. For \code{\link{monoMDS}},
+  the \dQuote{linear fit} and \eqn{R^2}{R2} from \dQuote{stress type
+  2} are equal.
 
   Both functions can be used both with \code{\link{metaMDS}},
   \code{\link{monoMDS}} and \code{\link[MASS]{isoMDS}}.  The original

Modified: pkg/vegan/man/monoMDS.Rd
===================================================================
--- pkg/vegan/man/monoMDS.Rd	2011-07-01 12:38:01 UTC (rev 1668)
+++ pkg/vegan/man/monoMDS.Rd	2011-07-01 13:47:10 UTC (rev 1669)
@@ -97,8 +97,11 @@
   where \eqn{d} are the observed dissimilarities, \eqn{\hat d}{dhat}
   are the fitted ordination distances, and \eqn{d_0}{dnull} are the
   ordination distances under null model. For \dQuote{stress 1}
-  \eqn{d_0 = 0}{dnull = 0}, and for \dQuote{stress 2} \eqn{d_0 = \bar
-  d}{dnull = dbar} or mean dissimilarities.
+  \eqn{d_0 = 0}{dnull = 0}, and for \dQuote{stress 2} \eqn{d_0 =
+  \bar{d}}{dnull = dbar} or mean dissimilarities.  \dQuote{Stress 2}
+  is the same as correlation between fitted values and ordination
+  distances, and so related to the \dQuote{linear fit} of
+  \code{\link{stressplot}}.
 
   Function \code{monoMDS} can fit several alternative NMDS variants
   that can be selected with argument \code{model}.  The default
@@ -110,8 +113,8 @@
   regression is used for each point (Sibson 1972).  Alternative
   \code{model = "linear"} fits a linear MDS. This fits a linear
   regression instead of monotone, and is not identical to metric
-  scaling or principal coordinates analysis that performs an
-  eigenvector decomposition of dissimilarities (Gower
+  scaling or principal coordinates analysis (\code{\link{cmdscale}})
+  that performs an eigenvector decomposition of dissimilarities (Gower
   1966). Alternative \code{model = "hybrid"} implements hybrid MDS
   thatuses monotone regression for all points and linear regression
   for dissimilarities below or at a \code{threshold} in alternating



More information about the Vegan-commits mailing list