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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 25 13:13:49 CEST 2010


Author: jarioksa
Date: 2010-05-25 13:13:48 +0200 (Tue, 25 May 2010)
New Revision: 1193

Modified:
   pkg/vegan/R/adonis.R
   pkg/vegan/R/anosim.R
   pkg/vegan/R/factorfit.R
   pkg/vegan/R/mantel.R
   pkg/vegan/R/vectorfit.R
   pkg/vegan/inst/ChangeLog
Log:
revert r846: do only n-1 permutations if n were asked and n is an even hundred

Modified: pkg/vegan/R/adonis.R
===================================================================
--- pkg/vegan/R/adonis.R	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/R/adonis.R	2010-05-25 11:13:48 UTC (rev 1193)
@@ -8,6 +8,11 @@
     ## variables.  data is the data frame from which A, B, and C would
     ## be drawn.
     TOL <- 1e-7
+    ## Set no. of permutations to x-1 if x is an even hundred
+    if (permutations %% 100 == 0) {
+        permutations <- permutations - 1
+        warning("Setting no. of permutations to ", permutations)
+    }
     Terms <- terms(formula, data = data)
     lhs <- formula[[2]]
     lhs <- eval(lhs, data, parent.frame()) # to force evaluation 

Modified: pkg/vegan/R/anosim.R
===================================================================
--- pkg/vegan/R/anosim.R	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/R/anosim.R	2010-05-25 11:13:48 UTC (rev 1193)
@@ -28,6 +28,8 @@
     cl.vec[within] <- levels(grouping)[grouping[take]]
     cl.vec <- factor(cl.vec, levels = c("Between", levels(grouping)))
     if (permutations) {
+        if (permutations %% 100 == 0)
+            permutations <- permutations - 1
         perm <- rep(0, permutations)
         for (i in 1:permutations) {
             take <- permuted.index(N, strata)

Modified: pkg/vegan/R/factorfit.R
===================================================================
--- pkg/vegan/R/factorfit.R	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/R/factorfit.R	2010-05-25 11:13:48 UTC (rev 1193)
@@ -28,6 +28,8 @@
         r.this <- 1 - invar/totvar
         r <- c(r, r.this)
         if (permutations) {
+            if (permutations %% 100 == 0)
+                permutations <- permutations - 1
             A <- as.integer(P[[i]])
             NL <- nlevels(P[[i]])
             tmp <- rep(NA, permutations)

Modified: pkg/vegan/R/mantel.R
===================================================================
--- pkg/vegan/R/mantel.R	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/R/mantel.R	2010-05-25 11:13:48 UTC (rev 1193)
@@ -8,6 +8,8 @@
     statistic <- as.numeric(tmp$estimate)
     variant <- tmp$method
     if (permutations) {
+        if (permutations %% 100 == 0)
+            permutatoins <- permutations - 1
         N <- attributes(xdis)$Size
         perm <- rep(0, permutations)
         for (i in 1:permutations) {

Modified: pkg/vegan/R/vectorfit.R
===================================================================
--- pkg/vegan/R/vectorfit.R	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/R/vectorfit.R	2010-05-25 11:13:48 UTC (rev 1193)
@@ -24,6 +24,8 @@
         colnames(heads) <- paste("Dim", 1:nc, sep = "")
     else colnames(heads) <- colnames(X)
     if (permutations) {
+        if (permutations %% 100 == 0)
+            permutations <- permutations - 1
         nr <- nrow(X)
         permstore <- matrix(nrow = permutations, ncol = ncol(P))
         for (i in 1:permutations) {

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-05-24 17:11:17 UTC (rev 1192)
+++ pkg/vegan/inst/ChangeLog	2010-05-25 11:13:48 UTC (rev 1193)
@@ -4,6 +4,11 @@
 
 Version 1.18-5 (opened May 21, 2010) 
 
+	* revert patch 846: put back patronizing adjustment of the number
+	permutations to n-1 if n requested was an even hundred (i.e., do
+	99 if 100 were asked). Concerns mantel, factorfit, vectofirt,
+	adonis and anosim.
+	
 	* ordiR2step: new function to perform forward model selection
 	following Blanchet, Legendre & Borcard (Ecology 89, 2623-2632;
 	2008) or by adjusted R2 until the adjusted R2 of the full model



More information about the Vegan-commits mailing list