[Vegan-commits] r300 - in pkg: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 30 18:56:33 CEST 2008


Author: gsimpson
Date: 2008-03-30 18:56:33 +0200 (Sun, 30 Mar 2008)
New Revision: 300

Modified:
   pkg/R/permutest.betadisper.R
   pkg/inst/ChangeLog
   pkg/man/permuted.index2.Rd
Log:
Improve computational stability of pairwise t tests in permuted.betadisper

Modified: pkg/R/permutest.betadisper.R
===================================================================
--- pkg/R/permutest.betadisper.R	2008-03-30 16:39:52 UTC (rev 299)
+++ pkg/R/permutest.betadisper.R	2008-03-30 16:56:33 UTC (rev 300)
@@ -4,10 +4,8 @@
     t.statistic <- function(x, y) {
         m <- length(x)
         n <- length(y)
-        xbar <- sum(x) / m
-        ybar <- sum(y) / n
-        #xvar <- var(x)
-        #yvar <- var(y)
+        xbar <- .Internal(mean(x))
+        ybar <- .Internal(mean(y))
         xvar <- .Internal(cov(x, NULL, 1, FALSE))
         yvar <- .Internal(cov(y, NULL, 1, FALSE))
         pooled <- sqrt(((m-1)*xvar + (n-1)*yvar) / (m+n-2))

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-03-30 16:39:52 UTC (rev 299)
+++ pkg/inst/ChangeLog	2008-03-30 16:56:33 UTC (rev 300)
@@ -7,7 +7,10 @@
 	* permute: New high-level untility function for facilitating
 	the production of permutation tests using the new permutation
 	designs allowed by permuted.index2(). An example of the new
-	API is shown in ?permute
+	API is shown in ?permute.
+
+	* permutest.betadisper: Pairwise t test function made more
+	computationally stable.
 	
 Version 1.12-7 (closed Mar 30, 2008)
 

Modified: pkg/man/permuted.index2.Rd
===================================================================
--- pkg/man/permuted.index2.Rd	2008-03-30 16:39:52 UTC (rev 299)
+++ pkg/man/permuted.index2.Rd	2008-03-30 16:56:33 UTC (rev 300)
@@ -152,8 +152,9 @@
     t.statistic <- function(x, y) {
         m <- length(x)
         n <- length(y)
-        xbar <- sum(x) / m
-        ybar <- sum(y) / n
+        ## means and variances, but for speed
+        xbar <- .Internal(mean(x))
+        ybar <- .Internal(mean(y))
         xvar <- .Internal(cov(x, NULL, 1, FALSE))
         yvar <- .Internal(cov(y, NULL, 1, FALSE))
         pooled <- sqrt(((m-1)*xvar + (n-1)*yvar) / (m+n-2))



More information about the Vegan-commits mailing list