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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 5 16:12:11 CET 2013


Author: jarioksa
Date: 2013-11-05 16:12:11 +0100 (Tue, 05 Nov 2013)
New Revision: 2650

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/permutest.cca.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/anova.cca.Rd
Log:
permutest.cca uses permute package

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2013-11-05 04:48:34 UTC (rev 2649)
+++ pkg/vegan/DESCRIPTION	2013-11-05 15:12:11 UTC (rev 2650)
@@ -1,12 +1,12 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 2.1-37
-Date: October 14, 2013
+Version: 2.1-38
+Date: November 5, 2013
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, 
    M. Henry H. Stevens, Helene Wagner  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
-Depends: permute (>= 0.7-4), lattice, R (>= 2.14.0)
+Depends: permute (>= 0.7-5), lattice, R (>= 2.14.0)
 Suggests: MASS, mgcv, cluster, parallel, scatterplot3d, rgl, tcltk
 Description: Ordination methods, diversity analysis and other
   functions for community and vegetation ecologists.

Modified: pkg/vegan/R/permutest.cca.R
===================================================================
--- pkg/vegan/R/permutest.cca.R	2013-11-05 04:48:34 UTC (rev 2649)
+++ pkg/vegan/R/permutest.cca.R	2013-11-05 15:12:11 UTC (rev 2650)
@@ -5,7 +5,7 @@
     stop("No default permutation test defined")
 
 `permutest.cca` <-
-    function (x, permutations = 99,
+    function (x, permutations = how(nperm=99),
               model = c("reduced", "direct", "full"), first = FALSE,
               strata = NULL, parallel = getOption("mc.cores") , ...) 
 {
@@ -113,15 +113,23 @@
     if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
         runif(1)
     seed <- get(".Random.seed", envir = .GlobalEnv, inherits = FALSE)
-    ## permutations
+    ## permutations is either a single number, a how() structure or a
+    ## permutation matrix
     if (length(permutations) == 1) {
-        if (is.null(strata))
-            permutations <- shuffleSet(N, permutations)
-        else
-            permutations <-
-                t(sapply(1:permutations,
-                         function(x) permuted.index(N, strata=strata))) 
+        nperm <- permutations
+        permutations <- how(nperm = nperm)
     }
+    if (!is.null(strata)) {
+        if (!inherits(permutations, "how"))
+            stop("'strata' can be used only with simple permutation or with 'how()'")
+        if (!is.null(permutations$block))
+            stop("'strata' cannot be applied when 'blocks' are defined in 'how()'")
+        permutations <- update(permutations, blocks = strata)
+    }
+    ## now permutations is either a how() structure or a permutation
+    ## matrix. Make it to a matrix if it is "how"
+    if (inherits(permutations, "how"))
+        permutations <- shuffleSet(N, control = permutations)
     nperm <- nrow(permutations)
     ## Parallel processing (similar as in oecosimu)
     if (is.null(parallel) || getRversion() < "2.14.0")

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-11-05 04:48:34 UTC (rev 2649)
+++ pkg/vegan/inst/ChangeLog	2013-11-05 15:12:11 UTC (rev 2650)
@@ -2,8 +2,20 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 2.1-37 (opened October 14, 2013)
+Version 2.1-38 (opened November 5, 2013)
 
+	* DESCRIPTION: depends on permute >= 0.7-5.
+
+	* permutest.cca: permutation test uses 'permute' package. The old
+	interface was retained, and 'permutations' can be a single number
+	or a permutation matrix (as previously), but now it can also be a
+	how() object of the 'permute' package. The argument 'strata' was
+	also retained, but it is planned to be deprecated in the future,
+	and it is recommended that users switch to defining 'blocks' in
+	how(). 
+	
+Version 2.1-37 (closed November 5, 2013)
+
 	* anova.cca: added new function anova.ccalist() to compare a
 	sequence of models. The function is still experimental ("proof of
 	the concept") and unexported. If this stays in vegan, it should

Modified: pkg/vegan/man/anova.cca.Rd
===================================================================
--- pkg/vegan/man/anova.cca.Rd	2013-11-05 04:48:34 UTC (rev 2649)
+++ pkg/vegan/man/anova.cca.Rd	2013-11-05 15:12:11 UTC (rev 2650)
@@ -23,7 +23,7 @@
 
 permutest(x, ...)
 
-\method{permutest}{cca}(x, permutations = 99,
+\method{permutest}{cca}(x, permutations = how(nperm=99),
           model = c("reduced", "direct", "full"),
           first = FALSE, strata = NULL, 
 	  parallel = getOption("mc.cores") , ...)
@@ -46,14 +46,23 @@
     \code{permutest.cca}. In \code{anova} with \code{by = "axis"} you
     can use argument \code{cutoff} (defaults \code{1}) which stops
     permutations after exceeding the given level. }
-  \item{permutations}{Number of permutations for assessing significance
-    of constraints.}
+  
+  \item{permutations}{Either a \code{\link[permute]{how}} result
+    defining permutations, or a permutation matrix with each row giving
+    the permutation indices, or the number of permutations for simple
+    permutations. See \code{\link{permutations}} for details.}
+
   \item{model}{Permutation model (partial match).}
   \item{first}{Assess only the significance of the first constrained
     eigenvalue; will be passed from \code{anova.cca}. }
+  
   \item{strata}{An integer vector or factor specifying the strata for
     permutation. If supplied, observations are permuted only within the
-    specified strata.}
+    specified strata. It is an error to use this when
+    \code{permutations} is a matrix, or a \code{\link[permute]{how}}
+    defines \code{blocks}. This is a legacy argument that will be
+    deprecated in the future: use \code{permutations = how(\dots, blocks)}
+    instead. }
 
   \item{parallel}{Number of parallel processes or a predefined socket
     cluster.  With \code{parallel = 1} uses ordinary, non-parallel



More information about the Vegan-commits mailing list