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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 26 08:39:45 CEST 2011


Author: psolymos
Date: 2011-09-26 08:39:45 +0200 (Mon, 26 Sep 2011)
New Revision: 1888

Modified:
   pkg/vegan/R/oecosimu.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/oecosimu.Rd
Log:
oecosimu can take simmat input

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2011-09-26 06:35:32 UTC (rev 1887)
+++ pkg/vegan/R/oecosimu.R	2011-09-26 06:39:45 UTC (rev 1888)
@@ -15,6 +15,13 @@
                 tmp
     }
 
+    if (inherits(comm, "simmat")) {
+        x <- comm
+        comm <- attr(comm, "data")
+        method <- attr(comm, "method")
+        simmat_in <- TRUE
+    } else simmat_in <- FALSE
+
     nm <- nullmodel(comm, method)
     if (nm$commsim$binary)
         comm <- ifelse(comm > 0, 1L, 0L)
@@ -25,18 +32,19 @@
             ind[[statistic]]
         else
             ind
-    
-    ## estimate thinning for "tswap" (trial swap)
-    if (nm$commsim$method == "tswap") {
-        checkbrd <-sum(designdist(comm, "(J-A)*(J-B)", 
-                                  "binary"))
-        M <- nm$ncol
-        N <- nm$nrow
-        checkbrd <- M * (M - 1) * N * (N - 1)/4/checkbrd
-        thin <- round(thin * checkbrd)
-        burnin <- round(burnin * checkbrd)
+    if (!simmat_in) {
+        ## estimate thinning for "tswap" (trial swap)
+        if (nm$commsim$method == "tswap") {
+            checkbrd <-sum(designdist(comm, "(J-A)*(J-B)", 
+                                      "binary"))
+            M <- nm$ncol
+            N <- nm$nrow
+            checkbrd <- M * (M - 1) * N * (N - 1)/4/checkbrd
+            thin <- round(thin * checkbrd)
+            burnin <- round(burnin * checkbrd)
+        }
+        x <- simulate(nm, nsim = nsimul, burnin = burnin, thin = thin)
     }
-    x <- simulate(nm, nsim = nsimul, burnin = burnin, thin = thin)
 
     simind <- apply(x, 3, applynestfun, fun = nestfun, statistic = statistic, ...) 
     simind <- matrix(simind, ncol = nsimul)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-09-26 06:35:32 UTC (rev 1887)
+++ pkg/vegan/inst/ChangeLog	2011-09-26 06:39:45 UTC (rev 1888)
@@ -4,6 +4,10 @@
 
 Version 2.1-1 (opened September 20, 2011)
 
+	* oecosimu can take a simmat object as comm argument,
+	so different statistics can be swept out based on the
+	same set of permuted matrices.
+
 	* permatfull/swap is using the new simulate(nullmodel(...)...)
 	infrastructure. permatfull1 and permatswap1 removed from vegan 
 	devel.

Modified: pkg/vegan/man/oecosimu.Rd
===================================================================
--- pkg/vegan/man/oecosimu.Rd	2011-09-26 06:35:32 UTC (rev 1887)
+++ pkg/vegan/man/oecosimu.Rd	2011-09-26 06:39:45 UTC (rev 1888)
@@ -29,7 +29,8 @@
 }
 
 \arguments{
-  \item{comm}{Community data.}
+  \item{comm}{Community data, or an object of class \code{simmat} (array 
+    of permuted matrices from \code{\link{simulae.nullmodel}}).}
   \item{x}{Community data for \code{commsimulator}, or an \code{oecosimu}
     result object for \code{as.ts}, \code{as.mcmc}, \code{density} and 
     \code{densityplot}.}



More information about the Vegan-commits mailing list