[Vegan-commits] r1557 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 28 21:16:09 CEST 2011


Author: jarioksa
Date: 2011-03-28 21:16:05 +0200 (Mon, 28 Mar 2011)
New Revision: 1557

Modified:
   pkg/vegan/R/oecosimu.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/oecosimu.Rd
Log:
gained arg 'tiesplit' to split tied statistics -- tests indicated this is not a good idea, but should be reverted

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2011-03-28 18:44:09 UTC (rev 1556)
+++ pkg/vegan/R/oecosimu.R	2011-03-28 19:16:05 UTC (rev 1557)
@@ -2,7 +2,7 @@
     function(comm, nestfun, method, nsimul=99,
              burnin=0, thin=1, statistic = "statistic",
              alternative = c("two.sided", "less", "greater"),
-             ...)
+             tiesplit = FALSE, ...)
 {
     alternative <- match.arg(alternative)
     nestfun <- match.fun(nestfun)
@@ -103,14 +103,18 @@
         z[sd < sqrt(.Machine$double.eps)] <- 0
     pless <- rowSums(indstat <= simind, na.rm = TRUE)
     pmore <- rowSums(indstat >= simind, na.rm = TRUE)
+    if (tiesplit)
+        ties <- rowSums(indstat == simind, na.rm = TRUE)/2
+    else
+        ties <- 0
     if (any(is.na(simind))) {
         warning("some simulated values were NA and were removed")
         nsimul <- nsimul - rowSums(is.na(simind))
     }
     p <- switch(alternative,
-                two.sided = 2*pmin(pless, pmore),
-                less = pless,
-                greater = pmore)
+                two.sided = 2*(pmin(pless, pmore) - ties),
+                less = pless - ties,
+                greater = pmore - ties)
     p <- pmin(1, (p + 1)/(nsimul + 1))
 
     ## ADDITION: if z is NA then it is not correct to calculate p values

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-03-28 18:44:09 UTC (rev 1556)
+++ pkg/vegan/inst/ChangeLog	2011-03-28 19:16:05 UTC (rev 1557)
@@ -4,6 +4,18 @@
 
 Version 1.18-26 (opened March 23, 2011)
 
+	* oecosimu: added argument 'tiesplit' (defaults FALSE). If TRUE,
+	simulated values tied with the observed statistic are split so
+	that half of them are regarded as satisfying the condition, and
+	removed from those cases which are greater or less (as given by
+	'alternative'). This is usually *not* done, but implementing
+	Raup-Crick dissimilarity in oecosimu() following
+	http://www.esajournals.org/doi/pdf/10.1890/ES10-00117.1 (Chase et
+	al., Ecosphere 2011) uses this option. However, cross-checking
+	the "r0" null model against the vegdist(..., "raup") indicates
+	that the options should be set FALSE (and this would mean that the
+	change is reverted).
+
 	* anova.ccabyaxis: I (JO) noticed in an ORDNEWS message that
 	anova(..., by = "axis") ignores the original Conditions in partial
 	models and so gives wrong results in partial models. The fix finds

Modified: pkg/vegan/man/oecosimu.Rd
===================================================================
--- pkg/vegan/man/oecosimu.Rd	2011-03-28 18:44:09 UTC (rev 1556)
+++ pkg/vegan/man/oecosimu.Rd	2011-03-28 19:16:05 UTC (rev 1557)
@@ -21,7 +21,7 @@
 \usage{
 oecosimu(comm, nestfun, method, nsimul = 99, burnin = 0, thin = 1,
    statistic = "statistic", alternative = c("two.sided", "less", "greater"),
-   ...)
+   tiesplit = FALSE, ...)
 commsimulator(x, method, thin=1)
 \method{as.ts}{oecosimu}(x, ...)
 \method{as.mcmc}{oecosimu}(x)
@@ -53,6 +53,9 @@
     or \code{"less"}. You can specify just the initial letter.}
   \item{data}{Ignored argument of the generic function.}
   \item{xlab}{Label of the x-axis.}
+  \item{tiesplit}{Tied values of simulations are split so that half of them are
+    regarded as fulfilling the condition of \code{alternative}. This is not 
+    usually done, but some published examples use splitting.}
   \item{\dots}{Other arguments to functions.}
 }
 



More information about the Vegan-commits mailing list