[Vegan-commits] r850 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 2 14:15:29 CEST 2009
Author: jarioksa
Date: 2009-06-02 14:15:27 +0200 (Tue, 02 Jun 2009)
New Revision: 850
Modified:
pkg/vegan/R/wcmdscale.R
pkg/vegan/inst/ChangeLog
Log:
wcmdscale: remove zero eigenvalues, keep negative, do not assume that last is zero (bugfix)
Modified: pkg/vegan/R/wcmdscale.R
===================================================================
--- pkg/vegan/R/wcmdscale.R 2009-06-02 08:04:30 UTC (rev 849)
+++ pkg/vegan/R/wcmdscale.R 2009-06-02 12:15:27 UTC (rev 850)
@@ -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: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-06-02 08:04:30 UTC (rev 849)
+++ pkg/vegan/inst/ChangeLog 2009-06-02 12:15:27 UTC (rev 850)
@@ -4,6 +4,9 @@
Version 1.16-19 (opened May 14, 2009)
+ * wcmdscale: remove zero eigenvalues, keep negative, and do not
+ assume that the last eigenvalue is zero.
+
* RsquareAdj.cca: returns R2, but no adjusted R2 (which is NA).
* kendall.global: fixed a bug that caused incorrect counts of ties
More information about the Vegan-commits
mailing list