[Vegan-commits] r856 - in branches/1.15: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 8 21:39:08 CEST 2009


Author: jarioksa
Date: 2009-06-08 21:39:07 +0200 (Mon, 08 Jun 2009)
New Revision: 856

Modified:
   branches/1.15/R/wcmdscale.R
   branches/1.15/inst/ChangeLog
Log:
merged r850 (wcmdscale zero eigenvalue fix) to branches/1.15

Modified: branches/1.15/R/wcmdscale.R
===================================================================
--- branches/1.15/R/wcmdscale.R	2009-06-03 13:06:47 UTC (rev 855)
+++ branches/1.15/R/wcmdscale.R	2009-06-08 19:39:07 UTC (rev 856)
@@ -23,6 +23,11 @@
     m <- t(weight.centre(t(m), w))
     m <- m * sqrt(w) %o% sqrt(w)
     e <- eigen(-m/2, symmetric = TRUE)
+    ## Remove zero eigenvalues, keep negative
+    keep <- abs(e$values) > ZERO
+    e$values <- e$values[keep]
+    e$vectors <- e$vectors[, keep]
+    ## Get number of positive eigenvalues
     if (missing(k))
         k <- sum(e$values > ZERO)
     ev <- e$values[1:k]
@@ -30,7 +35,7 @@
     points <- sweep(points, 2, sqrt(ev), "*")
     rownames(points) <- rownames(m)
     if (eig || x.ret || add) {
-        out <- list(points = points, eig = if (eig) e$values[-n],
+        out <- list(points = points, eig = if (eig) e$values,
                     x = if (x.ret) m, ac = NA, GOF = NA, weights = w)
         class(out) <- "wcmdscale"
     }

Modified: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog	2009-06-03 13:06:47 UTC (rev 855)
+++ branches/1.15/inst/ChangeLog	2009-06-08 19:39:07 UTC (rev 856)
@@ -5,6 +5,9 @@
 
 Version 1.15-3 (opened 28 May, 2009)
 
+	* merged r850: wcmdscale removes zero eigenvalues, but may keep
+	the last (unlike cmdscale).
+
 	* merged r845: summary.cca uses eigenvals.
 	
 	* copied eigenvals at r845.



More information about the Vegan-commits mailing list