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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 24 21:14:21 CET 2009


Author: psolymos
Date: 2009-02-24 21:14:20 +0100 (Tue, 24 Feb 2009)
New Revision: 706

Modified:
   pkg/vegan/R/lag.plot.permat.R
   pkg/vegan/R/permat.control.R
   pkg/vegan/R/permatfull.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/permatfull.Rd
Log:
Box test defaults changed in lag plot, plus check fixes


Modified: pkg/vegan/R/lag.plot.permat.R
===================================================================
--- pkg/vegan/R/lag.plot.permat.R	2009-02-24 19:17:53 UTC (rev 705)
+++ pkg/vegan/R/lag.plot.permat.R	2009-02-24 20:14:20 UTC (rev 706)
@@ -1,34 +1,35 @@
 `lag.plot.permat` <-
 function(x, type = "bray", sub=NULL, ...)
 {
-    lag <- 1
+    lags <- 1
+    Box.type <- "Ljung-Box"
     type <- match.arg(type, c("bray", "chisq"))
     ## this duality is required, because ylab can not be specified for lag.plot
     switch(type,
         "bray" = {
             out <- Bray.Curtis.Dissimilarities <- summary(x)[[type]]
             if (is.null(sub)) {
-                Bt <- Box.test(out, lag=lag)[c(1,2,3)]
+                Bt <- Box.test(out, lag=lags, type=Box.type)[c(1,2,3)]
                 names(Bt)[c(1,2)] <- c("X-squared", "df")
                 Bt[[1]] <- round(Bt[[1]], 3)
                 Bt[[3]] <- if (Bt[[3]] < 0.0001)
                     "< 0.0001" else round(Bt[[3]], 3)
-                sub <- paste("Box-Pierce test: ", paste(names(Bt), Bt, collapse=", "), collapse="")
+                sub <- paste(Box.type, " test: ", paste(names(Bt), "=", Bt, collapse=", "), collapse="")
             }
-            lag.plot(Bray.Curtis.Dissimilarities, lag=lag, sub=sub, ...)
+            lag.plot(Bray.Curtis.Dissimilarities, lags=lags, sub=sub, ...)
             invisible(out)
         },
         "chisq" = {
             out <- Chi.Squared.Values <- summary(x)[[type]]
             if (is.null(sub)) {
-                Bt <- Box.test(out, lag=lag)[c(1,2,3)]
+                Bt <- Box.test(out, lag=lags, type=Box.type)[c(1,2,3)]
                 names(Bt)[c(1,2)] <- c("X-squared", "df")
                 Bt[[1]] <- round(Bt[[1]], 3)
                 Bt[[3]] <- if (Bt[[3]] < 0.0001)
                     "< 0.0001" else round(Bt[[3]], 3)
-                sub <- paste("Box-Pierce test: ", paste(names(Bt), Bt, collapse=", "), collapse="")
+                sub <- paste(Box.type, " test: ", paste(names(Bt), "=", Bt, collapse=", "), collapse="")
             }
-            lag.plot(Chi.Squared.Values, lag=lag, sub=sub, ...)
+            lag.plot(Chi.Squared.Values, lags=lags, sub=sub, ...)
             invisible(out)
         })
 }

Modified: pkg/vegan/R/permat.control.R
===================================================================
--- pkg/vegan/R/permat.control.R	2009-02-24 19:17:53 UTC (rev 705)
+++ pkg/vegan/R/permat.control.R	2009-02-24 20:14:20 UTC (rev 706)
@@ -1,5 +1,5 @@
 `permat.control` <-
-function(ptype="full", mtype="count", method="quasiswap", fixedmar="both", shuffle="ind", strata=NULL, burnin=10000, thin=1000)
+function(ptype="full", mtype="count", method="quasiswap", fixedmar="both", shuffle="both", strata=NULL, burnin=10000, thin=1000)
 {
 list(ptype=ptype, mtype=mtype, method=method, fixedmar=fixedmar, shuffle=shuffle, strata=strata, burnin=burnin, thin=thin)
 }

Modified: pkg/vegan/R/permatfull.R
===================================================================
--- pkg/vegan/R/permatfull.R	2009-02-24 19:17:53 UTC (rev 705)
+++ pkg/vegan/R/permatfull.R	2009-02-24 20:14:20 UTC (rev 706)
@@ -1,6 +1,6 @@
 ## permatfull function
 `permatfull` <-
-function(m, fixedmar="both", shuffle="ind", strata=NULL, mtype="count", times=99)
+function(m, fixedmar="both", shuffle="both", strata=NULL, mtype="count", times=99)
 {
 ## internal function
 indshuffle <- function(x)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-02-24 19:17:53 UTC (rev 705)
+++ pkg/vegan/inst/ChangeLog	2009-02-24 20:14:20 UTC (rev 706)
@@ -4,6 +4,10 @@
 
 Version 1.16-14 (opened Feb 24, 2009)
 
+    * lag.plot.permat: lag plot for permat simulations to graphically
+    diagnose independence when using sequential algorithms. Ljung-Box
+    test is also performed and returned in the sub title.
+
 	* permatswap: two new methods (under "abuswap") added based on the
 	paper of Hardy 2008 (J Ecol 96, 914-926). These preserve row *and*
 	colunm occurrences, and row *or* column sums at the same

Modified: pkg/vegan/man/permatfull.Rd
===================================================================
--- pkg/vegan/man/permatfull.Rd	2009-02-24 19:17:53 UTC (rev 705)
+++ pkg/vegan/man/permatfull.Rd	2009-02-24 20:14:20 UTC (rev 706)
@@ -19,17 +19,17 @@
 restricted permutations (based on strata) are discussed in the Details section.}
 
 \usage{
-permatfull(m, fixedmar = "both", shuffle = "ind", strata = NULL, 
+permatfull(m, fixedmar = "both", shuffle = "both", strata = NULL, 
 mtype = "count", times = 99)
 permatswap(m, method = "quasiswap", fixedmar="both", shuffle = "both",
 strata = NULL, mtype = "count", times = 99, burnin = 10000, thin = 1000)
 permat.control(ptype = "full", mtype = "count", method = "quasiswap",
-fixedmar = "both", shuffle = "ind", strata = NULL, 
+fixedmar = "both", shuffle = "both", strata = NULL, 
 burnin = 10000, thin = 1000)
 \method{plot}{permat}(x, type = "bray", ylab, xlab, col, lty,
 lowess = TRUE, plot = TRUE, text = TRUE, ...)
 \method{lines}{permat}(x, type = "bray", ...)
-lag.plot.permat(x, type = "bray", sub=NULL, ...)
+\method{lag.plot}{permat}(x, type = "bray", sub=NULL, ...)
 \method{summary}{permat}(object, ...)
 \method{print}{summary.permat}(x, digits = 2, ...)
 }
@@ -47,7 +47,7 @@
   \item{x, object}{object of class \code{"permat"}}
   \item{digits}{number of digits used for rounding.}
   \item{ylab, xlab, col, lty}{graphical parameters for the \code{plot} method.}
-  \item{sub}{a sub title for the plot, if this is \code{NULL} for the \code{lag.plot.permat} function, the results of the Box-Pierce test is plotted as sub title.}
+  \item{sub}{a sub title for the plot, if this is \code{NULL} for the \code{lag.plot.permat} function, the results of the Ljung-Box test is plotted as sub title.}
   \item{type}{character, type of plot to be displayed: \code{"bray"} for Bray-Curtis dissimilarities, \code{"chisq"} for Chi-squared values.}
   \item{lowess, plot, text}{logical arguments for the \code{plot} method, whether a lowess curve should be drawn, the plot should be drawn, and statistic values should be printed on the plot.}
   \item{\dots}{other arguments passed to methods.}
@@ -128,8 +128,14 @@
 \author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca} and Jari Oksanen}
 
 \seealso{
+For other functions to permute matrices:
+
 \code{\link{commsimulator}}, \code{\link{r2dtable}}, \code{\link{sample}}, \code{\link[bipartite]{swap.web}},
 \code{\link{oecosimu}}, \code{\link{adipart}}}
+
+For time-series diagnostics:
+
+\code{\link{Box.test}}, \code{\link{lag.plot}}
 }
 \examples{
 ## A simple artificial community data matrix.



More information about the Vegan-commits mailing list