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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 12 14:06:25 CET 2009


Author: jarioksa
Date: 2009-02-12 14:06:24 +0100 (Thu, 12 Feb 2009)
New Revision: 683

Modified:
   pkg/vegan/R/anova.ccabyaxis.R
   pkg/vegan/inst/ChangeLog
Log:
anova.ccabyaxis gained argument 'cutoff' to stop permutation tests after reaching insignificant axes (experimental and still undocumented)

Modified: pkg/vegan/R/anova.ccabyaxis.R
===================================================================
--- pkg/vegan/R/anova.ccabyaxis.R	2009-02-09 10:26:36 UTC (rev 682)
+++ pkg/vegan/R/anova.ccabyaxis.R	2009-02-12 13:06:24 UTC (rev 683)
@@ -1,6 +1,7 @@
 "anova.ccabyaxis" <-
-function (object, ...) 
+function (object, cutoff = 1,  ...) 
 {
+    cutoff <- cutoff + sqrt(.Machine$double.eps)
     rnk <- object$CCA$rank
     if (!max(rnk, 0)) 
         stop("Needs a constrained ordination")
@@ -11,9 +12,9 @@
     axnam <- colnames(lc)
     df <- c(rep(1, rnk), object$CA$rank)
     chi <- c(object$CCA$eig, Residual = object$CA$tot.chi)
-    Fval <- c(numeric(rnk), NA)
+    Fval <- c(chi[1:rnk]/df[1:rnk]/chi[rnk+1]*df[rnk+1], NA)
     nperm <- c(numeric(rnk), NA)
-    Pval <- c(numeric(rnk), NA)
+    Pval <- rep(NA, rnk+1)
     out <- data.frame(df, chi, Fval, nperm, Pval)
     sol <- anova(object, first = TRUE, ...)
     out[c(1, rnk + 1), ] <- sol
@@ -38,6 +39,8 @@
                 bigseed <- get(".Random.seed", envir = .GlobalEnv, 
                   inherits = FALSE)
             }
+            if (out[i, "Pr(>F)"] > cutoff)
+                break
         }
     }
     assign(".Random.seed", bigseed, envir = .GlobalEnv)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-02-09 10:26:36 UTC (rev 682)
+++ pkg/vegan/inst/ChangeLog	2009-02-12 13:06:24 UTC (rev 683)
@@ -4,6 +4,14 @@
 
 Version 1.6-12 (opened Feb 9, 2009)
 
+	* anova.ccabyaxis: gained keyword 'cutoff' (defaults 1) to break
+	from permutation tests after exceeding the P-value given in the
+	argument. The keyword was introduced because rda and cca are
+	occasionally used with a huge number of constraints (like PCNM
+	vectors) where tests take a very long time, although only a couple
+	of first axes are significant. The keyword is still undocumented,
+	and will remain so because this change is still experimental. 
+	
 	* contribdiv: new functions for contribution diversity as an
 	alternative to simple additive diversity following Lu, Wagner &
 	Chen, Basic and Applied Ecology 8, 1-12 (2007).



More information about the Vegan-commits mailing list