[Vegan-commits] r2900 - in pkg/vegan: . R man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 14 11:06:39 CEST 2014


Author: jarioksa
Date: 2014-10-14 11:06:39 +0200 (Tue, 14 Oct 2014)
New Revision: 2900

Modified:
   pkg/vegan/NAMESPACE
   pkg/vegan/R/permustats.R
   pkg/vegan/R/permutest.betadisper.R
   pkg/vegan/man/permustats.Rd
   pkg/vegan/man/permutest.betadisper.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
Squashed commit of the following:

commit 857c8e06410d0cbe1cec8fe92f08fc7714bb3323
Merge: e6e7d99 98731c7
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Oct 14 11:37:41 2014 +0300

    Merge pull request #56 from jarioksa/permustats-fixes

    Permustats fixes

commit 98731c71d47d9c17fa713f43c1c54865a1a682ee
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Oct 14 11:30:44 2014 +0300

    summary of permustats failed with a vector of permutations

    Function assumed that permutations are in a column matrix (one
    column for each statistic). Now vectors of a single statistic are
    coerced to a column matrix. The summary failed with the following
    results: anosim, mantel (+ mantel.partial), mrpp and permutest.cca.

commit edfb8a7f98449f3539ced28e995ea67b51ffa1af
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Oct 14 11:05:52 2014 +0300

    export permutest.protest

commit e6e7d99abcf8a663d5e6156369f96589cd8e0cb6
Merge: 6b29357 6a45940
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Oct 14 10:48:38 2014 +0300

    Merge pull request #54 from gavinsimpson/improve-betadisper-ptest

    Improve permutest.betadisper returned object

commit 6a45940e7482dba683a0a838a48ae7e0462c5507
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 20:37:38 2014 -0600

    update author info

commit 74cd7296e5891de05f4caa82c6a2d1dba591f423
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 19:22:26 2014 -0600

    Updated reference material

commit 1a90a2339e66754441353cef67ae32a1ab773493
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 16:39:43 2014 -0600

    Need to replicate alternative if methods only supply a single alternative for multiple statistics, as per permustats.adonis and first example in ?permustats

commit 9647f58ea2c5f4c91cf5a48171137940e16c486c
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 16:15:56 2014 -0600

    update the test material for examples

commit aaef90cf317fab5f7c2898abbfc1607df70f9e91
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 15:37:55 2014 -0600

    Modification to the help to reflect removal of 'probs' and addition of 'interval'; other tweaks and minor changes

commit 8bac53666101084dd216b17147670dc6ddb7d908
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 15:34:53 2014 -0600

    include an indication of the type of test statistic in the names of the statistic component of the returned object

commit 560696a5692738059c26999401d0debe636ef3e2
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 14:50:04 2014 -0600

    don't transpose permutations; treat printed elements as test statistics 'tst.ind' in printCoefmat

commit 5c598511130d071272d84802ff6bb6a794486e74
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 11:03:34 2014 -0600

    Update the reference materials for testing examples

commit 1f7b4ce38daed82facab430dc658901a9b6063cf
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 10:44:20 2014 -0600

    really fix the printed interval statement; didn't set the separator

commit c95defa9e1eb79213f7f09d8c6cf18457e23de25
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 10:38:29 2014 -0600

    update the Rd fiile for permustats to remove argument probs and add argument interval

commit f5b0ed8d66fecd1363ade3c51265d3b1563f7564
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 10:36:11 2014 -0600

    update the example for permustats to illustrate use of interval

commit c75da6cd115b0f4155ff567e6c35b26c3b9b9b8f
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 10:35:00 2014 -0600

    tweak interval statement in print method

commit 41f31de7c9a014af5b2547e24cb39bfae2bf282d
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Mon Oct 13 10:34:08 2014 -0600

    implement Jari's suggestion of a single table with lower and upper defined for user-specified interval; for less and greater, upper and lower will be blank, respectively, under this scenario.

commit d11462a1bbb61eea5f70ae2b0172014cdc885a84
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sun Oct 12 21:03:15 2014 -0600

     * Add some tests of user-supplied 'probs'
     * rbind together tests with same alternative

commit 8adf8fddd7d048c7523fe35d51dfb747a0105671
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sun Oct 12 21:01:55 2014 -0600

    add an example of specifying probs

commit 06ed3ccd2b354235b94345db3045c887cf1f9c9c
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sun Oct 12 20:59:56 2014 -0600

    set dimnames rather than colnames

commit ce59956d7de3c892e6f7766fd39f9a790934156d
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sun Oct 12 17:28:42 2014 -0600

    document that probs can be a list if a vector of alternatives is present.

commit 7a2d3c77dc3a09005240a4a4c9fc7ce229bca532
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sun Oct 12 16:33:54 2014 -0600

    Additional improvements following discussions with Jari:

     * summary.permustats now handles multiple types of alternative hypotheses
     * print.summary.permustats prints different types of alternatives in separate tables
     * permustats.permutest.betadisper now correctly specifies the multiple alternative hypoetheses if pairwise tests were performed in permutest.betadisper

commit 9efe4b8de20c65b1e8f7ff16ff634e047088819e
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sat Oct 11 12:30:28 2014 -0600

    update reference materials

commit 1d423b3a9e009a0e0045ab5f495df7ed6bf501ab
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sat Oct 11 12:12:59 2014 -0600

    update example to use the new permustats method & draw some plots

commit fb7b12eff0588de8676fa29e451c81db6714fc0f
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sat Oct 11 12:12:17 2014 -0600

    add a permustats method for class 'permutest.betadisper'

commit 42b18892d752d74eff0cc40b43b22135979cb38a
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Sat Oct 11 11:19:33 2014 -0600

    return vector of observed statistic(s) and matrix of permuted values of the statistic(s) under the null hypothesis

Modified: pkg/vegan/NAMESPACE
===================================================================
--- pkg/vegan/NAMESPACE	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/NAMESPACE	2014-10-14 09:06:39 UTC (rev 2900)
@@ -246,14 +246,15 @@
 S3method(permustats, mantel)
 S3method(permustats, mrpp)
 S3method(permustats, oecosimu)
+S3method(permustats, permutest.betadisper)
 S3method(permustats, permutest.cca)
+S3method(permustats, protest)
 ## these return an error: no permutation data
 S3method(permustats, CCorA)
 S3method(permustats, envfit)
 S3method(permustats, factorfit)
 S3method(permustats, vectorfit)
 S3method(permustats, mso)
-S3method(permustats, permutest.betadisper)
 
 S3method(print, permustats)
 S3method(summary, permustats)

Modified: pkg/vegan/R/permustats.R
===================================================================
--- pkg/vegan/R/permustats.R	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/R/permustats.R	2014-10-14 09:06:39 UTC (rev 2900)
@@ -21,35 +21,47 @@
 ### modelled after print.oecosimu (should perhaps have oecosimu() args
 ### like 'alternative'
 
-`summary.permustats` <-
-    function(object, probs, ...)
-{
-    ## default cut levels for quantiles: these are two-sided
-    if (missing(probs))
-        probs <- switch(object$alternative,
-                        "two.sided" = c(0.025, 0.5, 0.975),
-                        "greater" = c(0.5, 0.95),
-                        "less" = c(0.05, 0.5)) 
-    sim <- t(object$permutations)
-    object$means <- rowMeans(sim)
-    sd <- apply(sim, 1, sd)
+`summary.permustats` <- function(object, interval = 0.95, ...) {
+    nalt <- length(object$alternative)
+    nstat <- length(object$statistic)
+    ## Replicate alternative to length of statistic
+    if ((nalt < nstat) && identical(nalt, 1L)) {
+        object$alternative <- rep(object$alternative, length.out = nstat)
+    }
+    TAB <- c("two.sided", "greater", "less")
+    compint <- (1 - interval) / 2
+    PROBS <- list(two.sided = c(compint, 0.5, interval + compint),
+                  greater = c(NA, 0.5, interval),
+                  less = c(1 - interval, 0.5, NA))
+    alt <- match(object$alternative, TAB)
+    probs <- PROBS[alt]
+    ## take care that permutations are in a column matrix
+    permutations <- as.matrix(object$permutations)
+    object$means <- colMeans(permutations)
+    sd <- apply(permutations, 2, sd)
     object$z <-
         (object$statistic - object$means)/sd
-    object$quantile <-
-        apply(sim, 1, quantile, probs = probs, na.rm = TRUE)
+    qFun <- function(i, sim, probs) {
+        quantile(sim[, i], probs = probs[[i]], na.rm = TRUE)
+    }
+    object$quantile <- lapply(seq_along(probs), qFun, sim = permutations, probs = probs)
+    object$quantile <- do.call("rbind", object$quantile)
+    dimnames(object$quantile) <- list(NULL, c("lower", "median", "upper"))
+    object$interval <- interval
     ## not (yet) P-values...
     class(object) <- "summary.permustats"
     object
 }
 
-`print.summary.permustats` <-
-    function(x, ...)
-{
+`print.summary.permustats` <- function(x, ...) {
     m <- cbind("statistic" = x$statistic,
                "z" = x$z,
                "mean" = x$means,
-               t(x$quantile))
-    printCoefmat(m, cs.ind = 3:ncol(m), ...)
+               x$quantile)
+    cat("\n")
+    printCoefmat(m, tst.ind = 1:ncol(m), na.print = "", ...)
+    writeLines(strwrap(paste0("(Interval (Upper - Lower) = ", x$interval, ")", sep = ""),
+                       initial = "\n"))
     invisible(x)
 }
 
@@ -237,5 +249,14 @@
 `permustats.permutest.betadisper` <-
     function(x, ...)
 {
-    stop("no permutation data available")
+    ntypes <- NCOL(x$perm)
+    alt <- if (ntypes > 1) {
+        c("greater", rep("two.sided", ntypes - 1))
+    } else {
+        "greater"
+    }
+    structure(list("statistic" = x$statistic,
+                   "permutations" = x$perm,
+                   "alternative" = alt),
+              class ="permustats")
 }

Modified: pkg/vegan/R/permutest.betadisper.R
===================================================================
--- pkg/vegan/R/permutest.betadisper.R	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/R/permutest.betadisper.R	2014-10-14 09:06:39 UTC (rev 2900)
@@ -104,7 +104,9 @@
     ## Process results
     F0 <- summary(mod)$fstatistic[1]
     Fstats <- round(Pstats[, 1], 12)    # allow empty dim to be dropped
-    F0 <- round(F0, 12)
+    statistic <- F0 <- round(F0, 12)
+    names(statistic) <- "Overall (F)"
+
     ## pairwise comparisons
     if(pairwise) {
         T0 <- apply(combn(levels(group), 2), 2, function(z) {
@@ -112,6 +114,7 @@
                         x$distances[group == z[2]])})
         Tstats <- round(Pstats[, -1, drop = FALSE], 12)
         T0 <- round(T0, 12)
+        statistic <- c(statistic, T0)
     }
 
     ## compute permutation p-value
@@ -123,20 +126,28 @@
                 length(x$distance[group == z[2]]) - 2})
         pairp <- (colSums(sweep(abs(Tstats), 2, abs(T0), '>=')) + 1) /
             (NROW(Tstats) + 1)
-        pairwise <- list(observed = 2 * pt(-abs(T0), df),
+        pairp <- list(observed = 2 * pt(-abs(T0), df),
                          permuted = pairp)
-        names(pairwise$observed) <- names(pairwise$permuted) <-
-            apply(combin, 2, paste, collapse = "-")
+        tnames <- apply(combin, 2, paste, collapse = "-")
+        names(pairp$observed) <- names(pairp$permuted) <- tnames
+        names(statistic)[-1] <- paste(tnames, "(t)")
     } else {
-        pairwise <- NULL
+        pairp <- NULL
     }
 
     retval <- cbind(mod.aov[, 1:4], c(nperm, NA), c(pval, NA))
     dimnames(retval) <- list(c("Groups", "Residuals"),
                              c("Df", "Sum Sq", "Mean Sq", "F", "N.Perm",
                                "Pr(>F)"))
-    retval <- list(tab = retval, pairwise = pairwise,
+    retval <- list(tab = retval,
+                   pairwise = pairp,
                    groups = levels(group),
+                   statistic = statistic,
+                   perm = if (pairwise) {
+                       structure(cbind(Fstats, Tstats), dimnames = list(NULL, names(statistic)))
+                   } else {
+                       structure(Fstats, names = names(statistic))
+                   },
                    control = attr(permutations, "control"))
     class(retval) <- "permutest.betadisper"
     retval

Modified: pkg/vegan/man/permustats.Rd
===================================================================
--- pkg/vegan/man/permustats.Rd	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/man/permustats.Rd	2014-10-14 09:06:39 UTC (rev 2900)
@@ -31,7 +31,7 @@
 
 \usage{
 permustats(x, ...)
-\method{summary}{permustats}(object, probs, ...)
+\method{summary}{permustats}(object, interval = 0.95, ...)
 \method{densityplot}{permustats}(x, data, xlab = "Permutations", ...)
 \method{density}{permustats}(x, observed = TRUE, ...)
 \method{qqnorm}{permustats}(y, observed = TRUE, ...)
@@ -40,11 +40,7 @@
 
 \arguments{
   \item{object, x, y}{The object to be handled.}
-  \item{probs}{Numeric vector of probabilities in [0,1] used in
-    \code{\link{quantile}} of permutations. If missing, default
-    quantiles will cover 95\% of permutations, and the values are
-    dependent on the test direction (either (0.025, 0.975), 0.05, or
-    0.95). In addition, default will give median (0.5). }
+  \item{interval}{numeric; the coverage interval reported.}
   \item{xlab, ylab}{Arguments of
     \code{\link[lattice]{densityplot}} and
     \code{\link[lattice]{qqmath}} functions.}
@@ -57,25 +53,26 @@
 \details{ 
 
   The \code{permustats} function extracts permutation results and
-  observed statistics from several \pkg{vegan} functions performing
+  observed statistics from several \pkg{vegan} functions that perform
   permutations or simulations.  
 
-  The \code{summary} of \code{permustats} estimates the \eqn{z} values,
-  also known as standardized effect sizes (SES) as the difference of
-  obseved statistic and mean of permutations divided by the standard
-  deviation of permutations. It also prints the the mean, median, and
-  limits which contain 95\% of permutations. For two-sided test these
-  are (2.5\%, 97.5\%) and for one-sided tests either 5\% or 95\%
+  The \code{summary} method of \code{permustats} estimates the \eqn{z}
+  values, also known as standardized effect sizes (SES) as the
+  difference of observed statistic and mean of permutations divided by
+  the standard deviation of permutations. It also prints the the mean,
+  median, and limits which contain \code{interval} percent of permuted
+  values. With the default (\code{interval = 0.95}), for two-sided test
+  these are (2.5\%, 97.5\%) and for one-sided tests either 5\% or 95\%
   quantile depending on the test direction. The mean, quantiles and
-  \eqn{z} values are evaluated from permutations without observed
+  \eqn{z} values are evaluated from permuted values without observed
   statistic.
 
   The \code{density} and \code{densityplot} methods display the
-  density of permutations. When observed value of the statistic is put
-  among the permutations, the \code{densityplot} method marks the
-  observed statistic as a vertical line. However \code{density} method
-  uses its standard \code{plot} method and cannot mark the obseved
-  value.
+  kernel density estimates of permuted values. When observed value of
+  the statistic is included in the permuted values, the
+  \code{densityplot} method marks the observed statistic as a vertical
+  line. However the \code{density} method uses its standard \code{plot}
+  method and cannot mark the obseved value.
 
   The \code{qqnorm} and \code{qqmath} display Q-Q plots of
   permutations, optionally together with the observed value (default)
@@ -96,9 +93,10 @@
   results of \code{\link{adonis}}, \code{\link{anosim}},
   \code{\link{mantel}}, \code{\link{mantel.partial}},
   \code{\link{mrpp}}, \code{\link{oecosimu}},
-  \code{\link{permutest.cca}}, and \code{\link{protest}}.  NB, there
-  is no \code{permustats} method for \code{\link{anova.cca}}, but only
-  for \code{\link{permutest.cca}}.
+  \code{\link{permutest.cca}}, \code{\link{protest}}, and
+  \code{\link{permutest.betadisper}}. NB, there is no \code{permustats}
+  method for \code{\link{anova.cca}}, but only for
+  \code{\link{permutest.cca}}.
 
 }
 
@@ -113,7 +111,10 @@
 }
 
 \author{
-  Jari Oksanen
+  Jari Oksanen with contributions from Gavin L. Simpson
+  (\code{permustats.permutest.betadisper} method and related
+  modifications to \code{summary.permustats} and the \code{print}
+  method.
 }
 
 \seealso{
@@ -130,6 +131,12 @@
 summary(perm)
 densityplot(perm)
 qqmath(perm)
+
+## example of multiple types of statistic
+mod <- with(dune.env, betadisper(vegdist(dune), Management))
+pmod <- permutest(mod, nperm = 99, pairwise = TRUE)
+perm <- permustats(pmod)
+summary(perm, interval = 0.90)
 }
 
 \keyword{ distribution }

Modified: pkg/vegan/man/permutest.betadisper.Rd
===================================================================
--- pkg/vegan/man/permutest.betadisper.Rd	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/man/permutest.betadisper.Rd	2014-10-14 09:06:39 UTC (rev 2900)
@@ -86,11 +86,16 @@
 anova(mod)
 
 ## Permutation test for F
-permutest(mod, permutations = 99, pairwise = TRUE)
+pmod <- permutest(mod, permutations = 99, pairwise = TRUE)
 
 ## Tukey's Honest Significant Differences
 (mod.HSD <- TukeyHSD(mod))
 plot(mod.HSD)
+
+## Has permustats() method
+pstat <- permustats(pmod)
+densityplot(pstat)
+qqmath(pstat)
 }
 \keyword{methods}
 \keyword{multivariate}

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2014-10-13 08:58:59 UTC (rev 2899)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2014-10-14 09:06:39 UTC (rev 2900)
@@ -160,7 +160,7 @@
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x7448210>
+<environment: 0x6e29998>
 Total model degrees of freedom 3 
 
 REML score: -3.185099     
@@ -4882,7 +4882,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x975bfa8>
+<environment: 0xa778b28>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -4899,7 +4899,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x89d2290>
+<environment: 0x8d569d8>
 
 Estimated degrees of freedom:
 6.45  total = 7.45 
@@ -4930,7 +4930,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x8fb08f0>
+<environment: 0x99320b0>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -4945,7 +4945,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "ts", fx = FALSE)
-<environment: 0x78c4998>
+<environment: 0x8889030>
 
 Estimated degrees of freedom:
 4.43  total = 5.43 
@@ -4974,7 +4974,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "ds", fx = FALSE)
-<environment: 0x9fe91d8>
+<environment: 0xa0d12d0>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -4990,7 +4990,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 4, bs = "tp", fx = TRUE)
-<environment: 0x90fa158>
+<environment: 0xa5300d0>
 
 Estimated degrees of freedom:
 3  total = 4 
@@ -5007,7 +5007,7 @@
 Formula:
 y ~ te(x1, x2, k = c(4, 4), bs = c("cr", "cr"), fx = c(FALSE, 
     FALSE))
-<environment: 0x89ebcd0>
+<environment: 0xa210368>
 
 Estimated degrees of freedom:
 2.99  total = 3.99 
@@ -5026,7 +5026,7 @@
 Formula:
 y ~ te(x1, x2, k = c(3, 4), bs = c("cs", "cs"), fx = c(TRUE, 
     TRUE))
-<environment: 0x99a2720>
+<environment: 0x83a12d0>
 
 Estimated degrees of freedom:
 11  total = 12 
@@ -5167,7 +5167,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa7534d8>
+<environment: 0xa427628>
 
 Estimated degrees of freedom:
 8.71  total = 9.71 
@@ -5180,7 +5180,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x8b20660>
+<environment: 0x6779228>
 
 Estimated degrees of freedom:
 7.18  total = 8.18 
@@ -5193,7 +5193,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xb43c2c8>
+<environment: 0xac467e8>
 
 Estimated degrees of freedom:
 8.32  total = 9.32 
@@ -5454,14 +5454,34 @@
 > ## use permustats
 > perm <- permustats(mod)
 > summary(perm)
-           statistic      z    mean     50%    95%
-Management    3.0730 4.5815 1.04617 0.94704 1.8475
-A1            2.7676 2.6322 1.03640 0.88513 2.3280
+
+           statistic      z   mean lower median  upper
+Management    3.0730 4.5815 1.0462       0.9470 1.8475
+A1            2.7676 2.6322 1.0364       0.8851 2.3280
+
+(Interval (Upper - Lower) = 0.95)
 > densityplot(perm)
 > qqmath(perm)
 > 
+> ## example of multiple types of statistic
+> mod <- with(dune.env, betadisper(vegdist(dune), Management))
+> pmod <- permutest(mod, nperm = 99, pairwise = TRUE)
+> perm <- permustats(pmod)
+> summary(perm, interval = 0.90)
+
+            statistic       z    mean   lower  median   upper
+Overall (F)    1.9506  0.6046  1.2061          0.8375  2.7743
+BF-HF (t)     -0.5634 -0.4179 -0.0584 -2.0011 -0.0974  1.8273
+BF-NM (t)     -2.2387 -1.8228 -0.0941 -2.1192 -0.0944  1.7339
+BF-SF (t)     -1.1675 -0.8886 -0.0928 -2.1442 -0.0866  1.8232
+HF-NM (t)     -2.1017 -1.8899 -0.0158 -1.8740  0.0412  1.6319
+HF-SF (t)     -0.8789 -0.7166 -0.0321 -1.8973 -0.0076  1.8362
+NM-SF (t)      0.9485  0.8309 -0.0036 -1.8411 -0.0531  1.9024
+
+(Interval (Upper - Lower) = 0.9)
 > 
 > 
+> 
 > cleanEx()
 > nameEx("permutest.betadisper")
 > ### * permutest.betadisper
@@ -5515,24 +5535,7 @@
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 > 
 > ## Permutation test for F
-> permutest(mod, permutations = 99, pairwise = TRUE)
-
-Permutation test for homogeneity of multivariate dispersions
-Permutation: free
-Number of permutations: 99
-
-Response: Distances
-          Df  Sum Sq  Mean Sq      F N.Perm Pr(>F)  
-Groups     1 0.07931 0.079306 4.6156     99   0.04 *
-Residuals 22 0.37801 0.017182                       
----
-Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
-
-Pairwise comparisons:
-(Observed p-value below diagonal, permuted p-value above diagonal)
-          grazed ungrazed
-grazed               0.05
-ungrazed 0.04295         
+> pmod <- permutest(mod, permutations = 99, pairwise = TRUE)
 > 
 > ## Tukey's Honest Significant Differences
 > (mod.HSD <- TukeyHSD(mod))
@@ -5547,8 +5550,13 @@
 
 > plot(mod.HSD)
 > 
+> ## Has permustats() method
+> pstat <- permustats(pmod)
+> densityplot(pstat)
+> qqmath(pstat)
 > 
 > 
+> 
 > cleanEx()
 > nameEx("plot.cca")
 > ### * plot.cca
@@ -7824,7 +7832,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xb0f94a8>
+<environment: 0xab91b78>
 
 Estimated degrees of freedom:
 1.28  total = 2.28 
@@ -8380,7 +8388,7 @@
 > ###
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  104.001 1.198 105.469 0 0 
+Time elapsed:  116.267 1.384 118.094 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list