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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 22 17:38:22 CET 2011


Author: jarioksa
Date: 2011-02-22 17:38:22 +0100 (Tue, 22 Feb 2011)
New Revision: 1505

Modified:
   pkg/vegan/R/specaccum.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/specaccum.Rd
Log:
thinking about implementation of weighted SAC models

Modified: pkg/vegan/R/specaccum.R
===================================================================
--- pkg/vegan/R/specaccum.R	2011-02-22 10:49:35 UTC (rev 1504)
+++ pkg/vegan/R/specaccum.R	2011-02-22 16:38:22 UTC (rev 1505)
@@ -1,7 +1,9 @@
 `specaccum` <-
     function (comm, method = "exact", permutations = 100, conditioned=TRUE,
-              gamma="jack1", ...)
+              gamma="jack1", w = NULL, ...)
 {
+    if (!is.null(w) && !(method %in% c("random", "collector")))
+        stop(gettextf("weights 'w' can be only used with methods 'random' and 'collector'"))
     x <- comm
     x <- as.matrix(x)
     x <- x[, colSums(x) > 0, drop=FALSE]
@@ -22,11 +24,15 @@
         message("No actual accumulation since only 1 site provided")
     switch(method, collector = {
         sites <- 1:n
+        weights <- cumsum(w)
         specaccum <- accumulator(x, sites)
     }, random = {
         perm <- array(dim = c(n, permutations))
+        if (!is.null(w))
+            weights <- array(dim = c(n, permutations))
         for (i in 1:permutations) {
-            perm[, i] <- accumulator(x, sample(n))
+            perm[, i] <- accumulator(x, ord <- sample(n))
+            weights[,i] <- cumsum(w[ord])
         }
         sites <- 1:n
         specaccum <- apply(perm, 1, mean)
@@ -87,6 +93,8 @@
     })
     out <- list(call = match.call(), method = method, sites = sites,
                 richness = specaccum, sd = sdaccum, perm = perm)
+    if (!is.null(weights))
+        out$weights <- weights
     if (method == "rarefaction")
         out$individuals <- ind
     class(out) <- "specaccum"

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-02-22 10:49:35 UTC (rev 1504)
+++ pkg/vegan/inst/ChangeLog	2011-02-22 16:38:22 UTC (rev 1505)
@@ -44,6 +44,12 @@
 	orthogonalization algorithm in the Fortran code presumably shared
 	between vegan:decorana and Canoco.
 
+	* specaccum: first step in implementing weights on
+	method="random".  Not yet documented nor supported.  Issues that
+	must be solved are plotting (all lines? summaries?), summarizing
+	(use approx to get average predictions?) and the very natural link
+	to fitspecaccum models.
+
 	* FAQ updates: using 'select' in ordination text() and points(),
 	using 'xlim' to flip axes or zoom into ordination plot(), the
 	non-effects of 'strata' in adonis(). All these indeed are

Modified: pkg/vegan/man/specaccum.Rd
===================================================================
--- pkg/vegan/man/specaccum.Rd	2011-02-22 10:49:35 UTC (rev 1504)
+++ pkg/vegan/man/specaccum.Rd	2011-02-22 16:38:22 UTC (rev 1505)
@@ -15,7 +15,7 @@
 }
 \usage{
 specaccum(comm, method = "exact", permutations = 100,
-          conditioned =TRUE, gamma = "jack1",  ...)
+          conditioned =TRUE, gamma = "jack1",  w = NULL, ...)
 \method{plot}{specaccum}(x, add = FALSE, ci = 2, ci.type = c("bar", "line", "polygon"), 
     col = par("fg"), ci.col = col, ci.lty = 1, xlab, 
     ylab = x$method, ylim, xvar = c("sites", "individuals"), ...)
@@ -63,6 +63,7 @@
   \item{object}{Either a community data set or fitted \code{specaccum} model.}
   \item{model}{Nonlinear regression model (\code{\link{nls}}). See Details.}
   \item{lty}{line type code (see \code{\link{par}}.}
+  \item{w}{Not yet documented.}
   \item{...}{Other parameters to functions.}
 }
 \details{



More information about the Vegan-commits mailing list