[Vegan-commits] r533 - in pkg: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 27 14:46:20 CET 2008


Author: jarioksa
Date: 2008-10-27 14:46:20 +0100 (Mon, 27 Oct 2008)
New Revision: 533

Modified:
   pkg/R/nesteddisc.R
   pkg/R/print.nesteddisc.R
   pkg/inst/ChangeLog
Log:
nesteddisc: added warning on the instability of discrepancy for ties in column frequencies

Modified: pkg/R/nesteddisc.R
===================================================================
--- pkg/R/nesteddisc.R	2008-10-27 08:02:55 UTC (rev 532)
+++ pkg/R/nesteddisc.R	2008-10-27 13:46:20 UTC (rev 533)
@@ -2,11 +2,11 @@
 function(comm)
 {
     comm <- ifelse(comm > 0, 1, 0)
-    j <- rev(order(colSums(comm)))
+    rs <- colSums(comm)
+    j <- rev(order(rs))
     comm <- comm[, j] 
     Ad <- sum(comm[col(comm) <= rowSums(comm)] == 0)
-    out <- list(statistic=Ad)
+    out <- list(statistic=Ad, ties = length(unique(rs)) < length(rs))
     class(out) <- "nesteddisc"
     out
 }
-

Modified: pkg/R/print.nesteddisc.R
===================================================================
--- pkg/R/print.nesteddisc.R	2008-10-27 08:02:55 UTC (rev 532)
+++ pkg/R/print.nesteddisc.R	2008-10-27 13:46:20 UTC (rev 533)
@@ -2,6 +2,7 @@
 function(x, ...)
 {
     cat("nestedness discrepancy:", x$statistic, "\n")
+    if(x$ties)
+        cat("There are tied column frequencies: result can depend on input order\n")
     invisible(x)
 }
-

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-10-27 08:02:55 UTC (rev 532)
+++ pkg/inst/ChangeLog	2008-10-27 13:46:20 UTC (rev 533)
@@ -4,6 +4,19 @@
 
 Version 1.16-3 (opened October 27, 2008)
 
+	* nesteddisc: Carsten Dormann (UFZ, Leipzig, Germany) turned my
+	attention to the sensitivity of discrepancy to ties in column
+	frequencies. These are not handled by any way (yet), but the users
+	are warned now about ties. For instance, the example matrix 'A' on
+	page 259 of Brualdi & Anderson (Oecologia 119, 256-264; 1999) can
+	be ordered to give discrepancy value = 2 instead of value = 3
+	reported in the paper with a different ordering of columns.
+	Different random reorderings of species in the 'sipoo' data in
+	vegan can give discrepancy values 51 to 58 (and the original
+	arbitrary ordering gives 55). This means that discrepancy values
+	are not very reliable, but ties should be handled better or the
+	function withdrawn from vegan. 
+
 	* ordisurf: returns x, y and z used by contour() following a query
 	"[R-sig-eco] output from ordisurf" on Oct 23, 2008.
 	



More information about the Vegan-commits mailing list