[Vegan-commits] r1500 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 20 12:26:09 CET 2011
Author: jarioksa
Date: 2011-02-20 12:26:09 +0100 (Sun, 20 Feb 2011)
New Revision: 1500
Modified:
pkg/vegan/R/decorana.R
pkg/vegan/inst/ChangeLog
Log:
computed zero decorana values are wrongly expanded to scores in rescaling and estimated eigenvalues based on those
Modified: pkg/vegan/R/decorana.R
===================================================================
--- pkg/vegan/R/decorana.R 2011-02-20 10:59:29 UTC (rev 1499)
+++ pkg/vegan/R/decorana.R 2011-02-20 11:26:09 UTC (rev 1500)
@@ -5,6 +5,7 @@
Const1 <- 1e-10
Const2 <- 5
Const3 <- 1e-11
+ ZEROEIG <- 1e-7 # consider as zero eigenvalue
veg <- as.matrix(veg)
if (any(rowSums(veg) <= 0))
stop("All row sums must be >0 in the community matrix: remove empty sites.")
@@ -147,6 +148,17 @@
var.c <- diag(var.c$cov) * (1 - sum(var.c$wt^2))
evals <- var.r/var.c
}
+ ## Some decorana values may be zero, but they still get expanded
+ ## in rescaling and get estimates of shrinkage eigenvalues: zero
+ ## them.
+ zeroeigs <- evals.decorana < ZEROEIG
+ if (any(zeroeigs)) {
+ evals.decorana[zeroeigs] <- 0
+ evals[zeroeigs] <- 0
+ rproj[, zeroeigs] <- 0
+ cproj[, zeroeigs] <- 0
+ origin[zeroeigs] <- 0
+ }
CA <- list(rproj = rproj, cproj = cproj, evals = evals, evals.decorana = evals.decorana,
origin = origin, v = v, fraction = v.fraction, adotj = adotj,
aidot = aidot, iweigh = iweigh, iresc = iresc, ira = ira,
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-02-20 10:59:29 UTC (rev 1499)
+++ pkg/vegan/inst/ChangeLog 2011-02-20 11:26:09 UTC (rev 1500)
@@ -17,6 +17,15 @@
* prestonfit, as.preston: default now 'tiesplit = TRUE'.
+ * decorana: Cajo ter Braak notified about false expansion of
+ computed zero eigenvalues in rescaling to axis scors and in
+ estimating eigenvalues. They are now zeroed. Cajo's example was a
+ 6x5 petrie matrix:
+ petrie <- matrix(0, 6, 5)
+ diag(petrie) <- 1
+ petrie[row(petrie) - 1 == col(petrie)] <- 1
+ decorana(petrie)
+
* FAQ updates: using 'select' in ordination text() and points(),
using 'xlim' to flip axes or zoom into ordination plot(), the
non-effects of 'strata' in adonis(). All these indeed are
More information about the Vegan-commits
mailing list