[Vegan-commits] r2890 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 1 09:51:49 CEST 2014


Author: jarioksa
Date: 2014-10-01 09:51:49 +0200 (Wed, 01 Oct 2014)
New Revision: 2890

Modified:
   pkg/vegan/R/permutest.betadisper.R
Log:
Squashed commit of the following:

commit 951be045be7286ce35160f36562b795b2bec7f96
Merge: 1ca9538 47f3482
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Tue Sep 30 10:22:12 2014 -0600

    Merge pull request #49 from gavinsimpson/master

    fix a bug in calculation of p value in group pairwise permutation test

commit 47f348283bff6c9d8939b2780b62fcde15e1ed84
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Tue Sep 30 10:01:53 2014 -0600

    fix a bug in calculation of p value in group pairwise permutation test introduced in c6b76f1

Modified: pkg/vegan/R/permutest.betadisper.R
===================================================================
--- pkg/vegan/R/permutest.betadisper.R	2014-09-30 07:24:02 UTC (rev 2889)
+++ pkg/vegan/R/permutest.betadisper.R	2014-10-01 07:51:49 UTC (rev 2890)
@@ -121,9 +121,10 @@
         df <- apply(combin, 2, function(z) {
             length(x$distances[group == z[1]]) +
                 length(x$distance[group == z[2]]) - 2})
+        pairp <- (colSums(sweep(abs(Tstats), 2, abs(T0), '>=')) + 1) /
+            (NROW(Tstats) + 1)
         pairwise <- list(observed = 2 * pt(-abs(T0), df),
-                         permuted = apply(Tstats, 2,
-                         function(z) (sum(abs(z) >= abs(z[1])) + 1) / (length(z) + 1)))
+                         permuted = pairp)
         names(pairwise$observed) <- names(pairwise$permuted) <-
             apply(combin, 2, paste, collapse = "-")
     } else {



More information about the Vegan-commits mailing list