[Vegan-commits] r1336 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 18 10:54:50 CEST 2010
Author: jarioksa
Date: 2010-10-18 10:54:50 +0200 (Mon, 18 Oct 2010)
New Revision: 1336
Modified:
pkg/vegan/R/isomap.R
pkg/vegan/inst/ChangeLog
Log:
isomap returns only axes with positive eigenvalues
Modified: pkg/vegan/R/isomap.R
===================================================================
--- pkg/vegan/R/isomap.R 2010-10-16 05:24:54 UTC (rev 1335)
+++ pkg/vegan/R/isomap.R 2010-10-18 08:54:50 UTC (rev 1336)
@@ -3,6 +3,14 @@
{
dist <- isomapdist(dist, ...)
out <- cmdscale(dist, k=ndim, eig=TRUE)
+ ## some versions of cmdscale may return NaN points corresponding
+ ## to negative eigenvalues
+ if (any(out$eig < 0)) {
+ out$eig <- out$eig[out$eig > 0]
+ out$points <- out$points[, seq_along(out$eig), drop = FALSE]
+ warning(gettextf("isomap returns only %d axes with positive eigenvalues",
+ length(out$eig)))
+ }
npoints <- nrow(out$points)
net <- matrix(FALSE, nrow=npoints, ncol=npoints)
net[lower.tri(net)][attr(dist, "net")] <- TRUE
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-10-16 05:24:54 UTC (rev 1335)
+++ pkg/vegan/inst/ChangeLog 2010-10-18 08:54:50 UTC (rev 1336)
@@ -4,6 +4,8 @@
Versin 1.18-14 (opened October 15, 2010)
+ * isomap: returns only axes associated with positive eigenvalues.
+
* wcmdscale: give two goodness of fit statistics for 'k' axes: one
is for the real part and based on the sum of positive eigenvalues,
and second is for all axes and based for the sum of absolute
More information about the Vegan-commits
mailing list