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

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


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

Modified:
   pkg/vegan/R/lag.plot.permat.R
   pkg/vegan/man/permatfull.Rd
Log:
Box-Pierce test added to lag.plot.permat


Modified: pkg/vegan/R/lag.plot.permat.R
===================================================================
--- pkg/vegan/R/lag.plot.permat.R	2009-02-24 18:45:15 UTC (rev 703)
+++ pkg/vegan/R/lag.plot.permat.R	2009-02-24 19:14:55 UTC (rev 704)
@@ -1,17 +1,33 @@
 `lag.plot.permat` <-
-function(x, type = "bray", ...)
+function(x, type = "bray", sub=NULL, ...)
 {
     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]]
-            lag.plot(Bray.Curtis.Dissimilarities, ...)
+            if (is.null(sub)) {
+                Bt <- Box.test(out)[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="")
+            }
+            lag.plot(Bray.Curtis.Dissimilarities, sub=sub, ...)
+            invisible(out)
         },
         "chisq" = {
             out <- Chi.Squared.Values <- summary(x)[[type]]
-            lag.plot(Chi.Squared.Values, ...)
+            if (is.null(sub)) {
+                Bt <- Box.test(out)[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="")
+            }
+            lag.plot(Chi.Squared.Values, sub=sub, ...)
+            invisible(out)
         })
-#    lag.plot(summary(x)[[match.arg(type, c("bray", "chisq"))]], ...)
-    invisible(out)
 }

Modified: pkg/vegan/man/permatfull.Rd
===================================================================
--- pkg/vegan/man/permatfull.Rd	2009-02-24 18:45:15 UTC (rev 703)
+++ pkg/vegan/man/permatfull.Rd	2009-02-24 19:14:55 UTC (rev 704)
@@ -29,7 +29,7 @@
 \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", ...)
+lag.plot.permat(x, type = "bray", sub=NULL, ...)
 \method{summary}{permat}(object, ...)
 \method{print}{summary.permat}(x, digits = 2, ...)
 }
@@ -47,6 +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{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.}



More information about the Vegan-commits mailing list