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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 16 13:30:16 CET 2009


Author: jarioksa
Date: 2009-03-16 13:30:16 +0100 (Mon, 16 Mar 2009)
New Revision: 747

Modified:
   pkg/vegan/R/oecosimu.R
   pkg/vegan/R/permatswap.R
   pkg/vegan/inst/ChangeLog
Log:
oecosimu & permatswap: much faster 'burnin' implemented as 'thin'

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2009-03-15 18:52:03 UTC (rev 746)
+++ pkg/vegan/R/oecosimu.R	2009-03-16 12:30:16 UTC (rev 747)
@@ -48,8 +48,7 @@
             attr(simind, "burnin") <- burnin
             x <- comm
             if (burnin > 0)
-                for(i in 1:burnin)
-                    x <- commsimulator(x, method= method, thin = round(checkbrd))
+                x <- commsimulator(x, method= method, thin = round(checkbrd) * burnin)
             for(i in 1:nsimul) {
                 x <- commsimulator(x, method = method, thin = thin)
                 tmp <- nestfun(x, ...)

Modified: pkg/vegan/R/permatswap.R
===================================================================
--- pkg/vegan/R/permatswap.R	2009-03-15 18:52:03 UTC (rev 746)
+++ pkg/vegan/R/permatswap.R	2009-03-16 12:30:16 UTC (rev 747)
@@ -1,6 +1,7 @@
 ## permatswap function
 `permatswap` <-
-function(m, method="quasiswap", fixedmar="both", shuffle="both", strata=NULL, mtype="count", times=99, burnin = 0, thin = 1)
+function(m, method="quasiswap", fixedmar="both", shuffle="both", strata=NULL,
+         mtype="count", times=99, burnin = 0, thin = 1)
 {
 ## internal function
 indshuffle <- function(x)
@@ -82,19 +83,19 @@
         nn.col <- ncol(m[id,])
         if (isSeq) {
             if (count) {
-                for (k in 1:burnin) {
+                if (burnin > 0) {
                     if (method == "swap")
                         temp <- .C("swapcount", m = as.double(temp),
                             as.integer(nn.row), as.integer(nn.col),
-                            as.integer(1), PACKAGE = "vegan")$m
+                            as.integer(burnin), PACKAGE = "vegan")$m
                     if (method == "abuswap")
                        temp <- .C("abuswap", m = as.double(temp),
                             as.integer(nn.row), as.integer(nn.col),
-                            as.integer(1), as.integer(direct), PACKAGE = "vegan")$m
+                            as.integer(burnin), as.integer(direct), PACKAGE = "vegan")$m
                 }
             } else {
-                for (k in 1:burnin)
-                    temp <- commsimulator(temp, method=method)
+                if (burnin > 0)
+                    temp <- commsimulator(temp, method=method, thin = burnin)
             }
             for (i in 1:times) {
                 if (count) {

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-03-15 18:52:03 UTC (rev 746)
+++ pkg/vegan/inst/ChangeLog	2009-03-16 12:30:16 UTC (rev 747)
@@ -4,18 +4,23 @@
 
 Version 1.16-15 (opened Mar 10, 2009)
 
-    * as.mcmc.permat: provides same functionality for permat
-    objects as as.mcmc.oecosimu for oecosimu objects.
+	* oecosimu & permatswap: much faster 'burnin' implemented through
+	'thin', and hence using a single C loop instead of multiple calls
+	and allocations to an R object.
 
-    * burnin and thin in permatswap: same default values (0 and 1,
-    respectively) are set for permatswap and oecosimu functions.
-    Previous defaults for permatswap were in conflict with oecosimu
-    when called by permat.control.
+	* as.mcmc.permat: provides same functionality for permat objects
+	as as.mcmc.oecosimu for oecosimu objects.
 
-    * hiersimu: new function to evaluate a statistic value at different
-    levels of a nested hierarchical sampling design. Based on oecosimu
-    and null model testing, but with evaluation process similar to adipart.
+	* burnin and thin in permatswap: same default values (0 and 1,
+	respectively) are set for permatswap and oecosimu functions.
+	Previous defaults for permatswap were in conflict with oecosimu
+	when called by permat.control.
 
+	* hiersimu: new function to evaluate a statistic value at
+	different levels of a nested hierarchical sampling design. Based
+	on oecosimu and null model testing, but with evaluation process
+	similar to adipart.
+
 	* metaMDS: automatic stepacross works with Euclidean, Manhattan
 	and other distances with no fixed upper limit.  However, this may
 	be meaningless, and a warning is issued. Fixed after a query to



More information about the Vegan-commits mailing list