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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 1 17:34:07 CET 2013


Author: jarioksa
Date: 2013-12-01 17:34:07 +0100 (Sun, 01 Dec 2013)
New Revision: 2789

Modified:
   pkg/vegan/R/anovacca.R
   pkg/vegan/R/anovacca.byterm.R
   pkg/vegan/man/anovacca.Rd
Log:
anovacca(..., by='axis') gained 'cutoff' argument

Modified: pkg/vegan/R/anovacca.R
===================================================================
--- pkg/vegan/R/anovacca.R	2013-12-01 16:26:11 UTC (rev 2788)
+++ pkg/vegan/R/anovacca.R	2013-12-01 16:34:07 UTC (rev 2789)
@@ -1,7 +1,8 @@
 `anovacca` <-
     function(object, ..., permutations = how(nperm=999), by = NULL,
              model = c("reduced", "direct", "full"),
-             parallel = getOption("mc.cores"), strata = NULL) 
+             parallel = getOption("mc.cores"), strata = NULL,
+             cutoff = 1) 
 {
     model <- match.arg(model)
     ## permutations is either a single number, a how() structure or a
@@ -64,7 +65,8 @@
                       model = model, parallel = parallel),
                       "axis" = anovacca.byaxis(object,
                       permutations = permutations,
-                      model = model, parallel = parallel))
+                      model = model, parallel = parallel,
+                      cutoff = cutoff))
         attr(sol, "Random.seed") <- seed
         attr(sol, "control") <- control
         return(sol)

Modified: pkg/vegan/R/anovacca.byterm.R
===================================================================
--- pkg/vegan/R/anovacca.byterm.R	2013-12-01 16:26:11 UTC (rev 2788)
+++ pkg/vegan/R/anovacca.byterm.R	2013-12-01 16:34:07 UTC (rev 2789)
@@ -100,7 +100,7 @@
 ### Marginal test for axes
 
 `anovacca.byaxis` <-
-    function(object, permutations, model, parallel)
+    function(object, permutations, model, parallel, cutoff = 1)
 {
     nperm <- nrow(permutations)
     ## Observed F-values and Df
@@ -124,7 +124,7 @@
     }
     LC <- as.data.frame(LC)
     fla <- reformulate(names(LC))
-    Pvals <- numeric(length(eig))
+    Pvals <- rep(NA, length(eig))
     environment(object$terms) <- environment()
     for (i in 1:length(eig)) {
         part <- paste("~ . +Condition(",
@@ -140,6 +140,8 @@
                           permutations, model = model,
                           parallel = parallel)
         Pvals[i] <- (sum(mod$F.perm >= mod$F.0) + 1)/(nperm+1)
+        if (Pvals[i] > cutoff)
+            break
     }
     out <- data.frame(c(Df, resdf), c(eig, object$CA$tot.chi),
                       c(Fstat, NA), c(Pvals,NA))

Modified: pkg/vegan/man/anovacca.Rd
===================================================================
--- pkg/vegan/man/anovacca.Rd	2013-12-01 16:26:11 UTC (rev 2788)
+++ pkg/vegan/man/anovacca.Rd	2013-12-01 16:34:07 UTC (rev 2789)
@@ -24,7 +24,8 @@
 \usage{
 anovacca(object, ..., permutations = how(nperm=999),
       by = NULL, model = c("reduced", "direct", "full"), 
-      parallel = getOption("mc.cores"), strata = NULL)
+      parallel = getOption("mc.cores"), strata = NULL,
+      cutoff = 1)
 }
 
 \arguments{
@@ -59,6 +60,9 @@
     deprecated in the future: use 
     \code{permutations = how(\dots, blocks)} instead. }
 
+  \item{cutoff}{Only effective with \code{by="axis"} where stops
+    permutations after an axis exceeds the \code{cutoff}.}
+
   \item{\dots}{Parameters passed to other functions.  \code{anova.cca}
     passes all arguments to \code{permutest.cca}. In \code{anova} with
     \code{by = "axis"} you can use argument \code{cutoff} (defaults



More information about the Vegan-commits mailing list