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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 5 08:27:11 CET 2009


Author: jarioksa
Date: 2009-03-05 08:27:10 +0100 (Thu, 05 Mar 2009)
New Revision: 719

Added:
   pkg/vegan/R/as.ts.oecosimu.R
Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/oecosimu.Rd
Log:
as.ts.oecosimu: a new function allowing time series analysis of sequential null models

Added: pkg/vegan/R/as.ts.oecosimu.R
===================================================================
--- pkg/vegan/R/as.ts.oecosimu.R	                        (rev 0)
+++ pkg/vegan/R/as.ts.oecosimu.R	2009-03-05 07:27:10 UTC (rev 719)
@@ -0,0 +1,9 @@
+`as.ts.oecosimu` <-
+    function(x, ...)
+{
+    seqmethods <- c("swap", "tswap")
+    if (!(x$oecosimu$method %in% seqmethods))
+        stop("as.ts available only for sequential methods ",
+             paste(seqmethods, collapse=", "))
+    as.ts(t(x$oecosimu$simulated))
+}

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-03-04 07:39:29 UTC (rev 718)
+++ pkg/vegan/inst/ChangeLog	2009-03-05 07:27:10 UTC (rev 719)
@@ -4,6 +4,11 @@
 
 Version 1.16-14 (opened Feb 24, 2009)
 
+	* as.ts.oecosimu: new function for applying time series methods
+	for sequential null models ("swap", "tswap").  The method was
+	implemented to study a lighter alternative to permat.tsdiag and
+	lagplot functions of "permat" objects.
+
 	* metaMDSrotate: a new function to rotate metaMDS configuration so
 	that the first axis is parallel with a continuous site variable.
 	

Modified: pkg/vegan/man/oecosimu.Rd
===================================================================
--- pkg/vegan/man/oecosimu.Rd	2009-03-04 07:39:29 UTC (rev 718)
+++ pkg/vegan/man/oecosimu.Rd	2009-03-05 07:27:10 UTC (rev 719)
@@ -3,6 +3,7 @@
 \alias{oecosimu}
 \alias{commsimulator}
 \alias{print.oecosimu}
+\alias{as.ts.oecosimu}
 
 \title{ Null Models for Biological Communities }
 
@@ -18,10 +19,13 @@
 oecosimu(comm, nestfun, method, nsimul = 99, burnin = 0, thin = 1,
    statistic = "statistic", control, ...)
 commsimulator(x, method, thin=1)
+\method{as.ts}{oecosimu}(x, ...)
 }
 
 \arguments{
-  \item{comm, x}{Community data. }
+  \item{comm}{Community data.}
+  \item{x}{Community data for \code{commsimulator}, or an \code{oecosimu}
+    result object for \code{as.ts}.}
   \item{nestfun}{Function to analyse nestedness. Some functions are
   provided in \pkg{vegan}, but any function can be used if it accepts the
   community as the first argument, and returns either a plain number or
@@ -126,13 +130,20 @@
   into matrix. The \code{quasiswap} method is not sequential, but it produces
   a random incidence matrix with given marginal totals. 
 
+  Function \code{as.ts} transforms the simulated results of sequential
+  methods into a time series or a \code{\link{ts}} object. This allows
+  using analytic tools for time series in studying the sequences (see
+  examples).
+
   As a result of method \code{permat} in \code{oecosimu}, quantitative
-  community null models are used to evaluate the statistic. Through the \code{control}
-  argument, further options can be set via the function \code{\link{permat.control}}.
-  A full description of these settings can be found on the help pages of the
-  functions \code{\link{permatfull}} and \code{\link{permatswap}}. Note, that
-  \code{burnin} and \code{thin} arguments given in the \code{oecosimu} function call
-  overwrite the respective ones specified by \code{permat.control}.
+  community null models are used to evaluate the statistic. Through
+  the \code{control} argument, further options can be set via the
+  function \code{\link{permat.control}}.  A full description of these
+  settings can be found on the help pages of the functions
+  \code{\link{permatfull}} and \code{\link{permatswap}}. Note, that
+  \code{burnin} and \code{thin} arguments given in the \code{oecosimu}
+  function call overwrite the respective ones specified by
+  \code{permat.control}.  
 }
 
 \value{
@@ -206,8 +217,9 @@
 caeval <- function(x) decorana(x, ira=1)$evals
 out <- oecosimu(sipoo, caeval, "swap", burnin=100, thin=10)
 out
-## Inspect the swap sequence
-matplot(t(out$oecosimu$simulated), type="l")
+## Inspect the swap sequence as a time series object
+plot(as.ts(out))
+lag.plot(as.ts(out))
 ## Use quantitative null models to compare
 ## mean Bray-Curtis dissimilarities
 data(dune)



More information about the Vegan-commits mailing list