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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 2 07:24:17 CEST 2014


Author: jarioksa
Date: 2014-10-02 07:24:17 +0200 (Thu, 02 Oct 2014)
New Revision: 2891

Removed:
   pkg/vegan/R/scoverage.R
Modified:
   pkg/vegan/NAMESPACE
   pkg/vegan/R/nestedchecker.R
   pkg/vegan/R/nesteddisc.R
   pkg/vegan/R/nestedn0.R
   pkg/vegan/R/nestedtemp.R
   pkg/vegan/R/simulate.rda.R
   pkg/vegan/man/decostand.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
Squashed commit of the following:

commit c36a60df653b55f05f218b47a714f236a8734cfd
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Thu Oct 2 08:21:53 2014 +0300

    update tests/Examples

commit 51db4dab9329ca8fd26dfe8476b4cad15c5a6ec2
Merge: 2ac73ea f6ad372
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Wed Oct 1 15:53:29 2014 -0600

    Merge pull request #50 from jarioksa/revert-scoverage

    remove scoverage()

commit f6ad3723b084ab0abdad89132c524c6457f1a3bd
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Wed Oct 1 23:11:24 2014 +0300

    remove scoverage()

    If this function is resurrected, it should be documented independently
    and not with the decostand.

commit 2ac73ea242b5388ba935dd9efe5bc904ed8af509
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Wed Oct 1 15:02:53 2014 +0300

    simulate.[rda,cca,capscale] only work with constrained ordination

    Earlier they gave results, but these were wrong because fitted
    component did not exist, and wrong component was used for them.
    Now check and stop informatively.

commit 087a7250d12ee08e543696cfa84ebe84bbcd5ea5
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Wed Oct 1 12:01:32 2014 +0300

    Update tests/Examples

commit fddbfc7c683d6a8f58e4838c20b07c2ddb22bde7
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Wed Oct 1 11:56:41 2014 +0300

    nestedness indices return named statistics

commit 951be045be7286ce35160f36562b795b2bec7f96
Merge: 1ca9538 47f3482
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Tue Sep 30 10:22:12 2014 -0600

    Merge pull request #49 from gavinsimpson/master

    fix a bug in calculation of p value in group pairwise permutation test

commit 47f348283bff6c9d8939b2780b62fcde15e1ed84
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Tue Sep 30 10:01:53 2014 -0600

    fix a bug in calculation of p value in group pairwise permutation test introduced in c6b76f1

Modified: pkg/vegan/NAMESPACE
===================================================================
--- pkg/vegan/NAMESPACE	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/NAMESPACE	2014-10-02 05:24:17 UTC (rev 2891)
@@ -22,7 +22,7 @@
 pcnm, permatfull, permatswap, permustats, permutest,
 poolaccum, postMDS, prc, prestondistr, prestonfit, procrustes,
 protest, radfit, radlattice, rankindex, rarefy, rarecurve, raupcrick,
-rda, renyiaccum, renyi, rrarefy, scores, scoverage,
+rda, renyiaccum, renyi, rrarefy, scores,
 showvarparts, simper, spandepth,
 spantree, specaccum, specnumber, specpool2vect, specpool, spenvcor,
 stepacross, stressplot, swan, tabasco, taxa2dist, taxondive, tolerance,

Modified: pkg/vegan/R/nestedchecker.R
===================================================================
--- pkg/vegan/R/nestedchecker.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/nestedchecker.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -4,6 +4,7 @@
     cb <- sum(designdist(comm, "(A-J)*(B-J)", "binary"))
     sppairs <- ncol(comm)*(ncol(comm)-1)/2
     out <- list("C.score" = cb/sppairs, statistic = cb)
+    names(out$statistic) <- "checkerboards"
     class(out) <- "nestedchecker"
     out
 }

Modified: pkg/vegan/R/nesteddisc.R
===================================================================
--- pkg/vegan/R/nesteddisc.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/nesteddisc.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -65,6 +65,7 @@
         }
     }
     out <- list(statistic=Ad, ties = ties, order = k[x])
+    names(out$statistic) <- "discrepancy"
     class(out) <- "nesteddisc"
     out
 }

Modified: pkg/vegan/R/nestedn0.R
===================================================================
--- pkg/vegan/R/nestedn0.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/nestedn0.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -8,6 +8,7 @@
     for (i in 1:ncol(comm))
         n0[i] <- sum(comm[,i] == 0 & R > spmin[i])
     out <- list(spmin = spmin, n0 = n0, statistic = sum(n0))
+    names(out$statistic) <- "N0"
     class(out) <- "nestedn0"
     out
 }

Modified: pkg/vegan/R/nestedtemp.R
===================================================================
--- pkg/vegan/R/nestedtemp.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/nestedtemp.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -88,6 +88,7 @@
     temp <- 100*sum(u)/prod(dim(comm))/0.04145
     out <- list(comm = comm, u = u, r = r, c = c, p = p,
                 fill=fill,  statistic = temp, smooth=smo)
+    names(out$statistic) <- "temperature"
     class(out) <- "nestedtemp"
     out
 }

Deleted: pkg/vegan/R/scoverage.R
===================================================================
--- pkg/vegan/R/scoverage.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/scoverage.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -1,14 +0,0 @@
-scoverage <- function(x, coverage.limit = 10) {
-    x <- as.matrix(x)
-    n <- rowSums(x)
-    if (any(n <= 0))
-        stop("negative or zero row totals not allowed")
-    ## check if comm contains integer, especially for singletons
-    if (any(x[x>0] < 1))
-        warning("<1 non integer values detected: analysis might not be meaningful")
-    if (abs(sum(x) - sum(as.integer(x))) > 10^-6)
-        warning("non integer values detected")
-    C1 <- 1 - rowSums(x==1) / n
-    a <- decostand(x, "total")
-    ifelse(x < coverage.limit, a * C1, a)
-}

Modified: pkg/vegan/R/simulate.rda.R
===================================================================
--- pkg/vegan/R/simulate.rda.R	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/R/simulate.rda.R	2014-10-02 05:24:17 UTC (rev 2891)
@@ -2,6 +2,12 @@
     function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full",
              correlated = FALSE, ...) 
 {
+    ## Fail if there is no constrained component (it could be possible
+    ## to change the function to handle unconstrained ordination, too,
+    ## when rank < "full", but that would require redesign)
+    if (is.null(object$CCA))
+        stop("function can be used only with constrained ordination")
+    
     ## Handle RNG: code directly from stats::simulate.lm
     if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
         runif(1)
@@ -29,7 +35,7 @@
                           nsim, nrow(indx)))
     ## Proper simulation: very similar for simulate.lm, but produces
     ## an array of response matrices
-    
+
     ftd <- predict(object, type = "response", rank = rank)
     ## pRDA: add partial Fit to the constrained
     if (!is.null(object$pCCA))
@@ -91,6 +97,9 @@
     function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full",
              correlated = FALSE, ...)
 {
+    ## Fail if no CCA
+    if (is.null(object$CCA))
+        stop("function can be used only with constrained ordination")
     ## Handle RNG: code directly from stats::simulate.lm
     if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
         runif(1)
@@ -183,6 +192,9 @@
     function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full",
              correlated = FALSE, ...) 
 {
+    ## Fail if no CCA component
+    if (is.null(object$CCA))
+        stop("function can be used only with constrained ordination")
     if (is.null(indx) && correlated)
         warning("argument 'correlated' does not work and will be ignored")
     ## Handle RNG: code directly from stats::simulate.lm

Modified: pkg/vegan/man/decostand.Rd
===================================================================
--- pkg/vegan/man/decostand.Rd	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/man/decostand.Rd	2014-10-02 05:24:17 UTC (rev 2891)
@@ -2,7 +2,6 @@
 \name{decostand}
 \alias{decostand}
 \alias{wisconsin}
-\alias{scoverage}
 
 \title{Standardization Methods for Community Ecology}
 \description{
@@ -11,10 +10,7 @@
 }
 \usage{
 decostand(x, method, MARGIN, range.global, logbase = 2, na.rm=FALSE, ...)
-
 wisconsin(x)
-
-scoverage(x, coverage.limit = 10)
 }
 
 \arguments{
@@ -28,8 +24,6 @@
     \code{x}. }
   \item{logbase}{The logarithm base used in \code{method = "log"}.}
   \item{na.rm}{Ignore missing values in row or column standardizations.}
-  \item{coverage.limit}{Integer, the sample coverage based correction 
-    is applied to rare species with counts below this limit.}
   \item{\dots}{Other arguments to the function (ignored).}
 }
 \details{
@@ -86,16 +80,6 @@
   data. If there are empty sites or species (or constant with
   \code{method =  "range"}), many standardization will change these into
   \code{NaN}.  
-
-  \code{scoverage} calculates sample relative frequencies
-  (divide by row total, \code{method = "total"} in \code{decostand})
-  for species with abundances larger than or equal to \code{coverage.limit}.
-  The sample coverage based correction proposed by Turing (see Good 1953)
-  is calculated for species with abundances smaller than 
-  \code{coverage.limit}. The correction is based on the number of
-  singleton species in each row.
-  The function expects nonnegative integer values in the community matrix
-  with no empty rows.
 }
 \value{
   Returns the standardized data frame, and adds an attribute
@@ -103,8 +87,7 @@
   \code{"method"}.
 }
 \author{Jari Oksanen, Etienne \enc{Laliberté}{Laliberte}
-  (\code{method = "log"}),
-  Peter Solymos (\code{scoverage}).}
+  (\code{method = "log"}).}
 \note{Common transformations can be made with standard \R functions.}
 
 \references{ 
@@ -113,10 +96,6 @@
   dispersion as a measure of beta diversity. \emph{Ecology Letters} 
   \strong{9}, 683--693.
 
-  Good, I. J. 1953. The population frequencies of species and the
-  estimation of population parameters. \emph{Biometrika}
-  \strong{40}, 237--264.
-
   Legendre, P. & Gallagher, E.D. (2001) Ecologically meaningful
   transformations for ordination of species data. \emph{Oecologia}
   \strong{129}, 271--280.
@@ -136,9 +115,6 @@
 ## Use wcmdscale for weighted analysis and identical results.
 sptrans <- decostand(varespec, "chi.square")
 plot(procrustes(rda(sptrans), cca(varespec)))
-
-data(mite)
-sptrans <- scoverage(mite)
 }
 \keyword{ multivariate}
 \keyword{ manip }

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2014-10-01 07:51:49 UTC (rev 2890)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2014-10-02 05:24:17 UTC (rev 2891)
@@ -160,7 +160,7 @@
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x672f560>
+<environment: 0x640f490>
 Total model degrees of freedom 3 
 
 REML score: -3.185099     
@@ -1106,7 +1106,7 @@
 Pairwise comparisons:
 (Observed p-value below diagonal, permuted p-value above diagonal)
           grazed ungrazed
-grazed               0.56
+grazed               0.05
 ungrazed 0.04295         
 > 
 > ## Tukey's Honest Significant Differences
@@ -2164,7 +2164,7 @@
 > 
 > ### Name: decostand
 > ### Title: Standardization Methods for Community Ecology
-> ### Aliases: decostand wisconsin scoverage
+> ### Aliases: decostand wisconsin
 > ### Keywords: multivariate manip
 > 
 > ### ** Examples
@@ -2191,11 +2191,8 @@
 > sptrans <- decostand(varespec, "chi.square")
 > plot(procrustes(rda(sptrans), cca(varespec)))
 > 
-> data(mite)
-> sptrans <- scoverage(mite)
 > 
 > 
-> 
 > cleanEx()
 > nameEx("designdist")
 > ### * designdist
@@ -4192,8 +4189,8 @@
 Checkerboard Units    : 2767 
 C-score (species mean): 2.258776 
 
-          statistic       z   mean   2.5%    50%  97.5% Pr(sim.)
-statistic      2767 0.84129 2698.1 2584.4 2676.0 2858.1     0.39
+              statistic       z   mean   2.5%    50%  97.5% Pr(sim.)
+checkerboards      2767 0.84129 2698.1 2584.4 2676.0 2858.1     0.39
 > ## Another Null model and standardized checkerboard score
 > oecosimu(sipoo, nestedchecker, "r00", statistic = "C.score")
 oecosimu object
@@ -4335,8 +4332,8 @@
 Checkerboard Units    : 2767 
 C-score (species mean): 2.258776 
 
-          statistic       z   mean   2.5%    50%  97.5% Pr(sim.)   
-statistic      2767 -17.768 8034.6 7529.9 8052.0 8518.5     0.01 **
+              statistic       z   mean   2.5%    50%  97.5% Pr(sim.)   
+checkerboards      2767 -17.768 8034.6 7529.9 8052.0 8518.5     0.01 **
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 > ## sequential model, one-sided test, a vector statistic
@@ -4905,7 +4902,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa4cab30>
+<environment: 0xa8e2d20>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -4922,7 +4919,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x896d590>
+<environment: 0xa0f4ee0>
 
 Estimated degrees of freedom:
 6.45  total = 7.45 
@@ -4953,7 +4950,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa9078f0>
+<environment: 0x9fe1070>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -4968,7 +4965,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "ts", fx = FALSE)
-<environment: 0x994c6c8>
+<environment: 0x9c8d8d0>
 
 Estimated degrees of freedom:
 4.43  total = 5.43 
@@ -4997,7 +4994,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "ds", fx = FALSE)
-<environment: 0xb548290>
+<environment: 0x9eb7d88>
 
 Estimated degrees of freedom:
 5.63  total = 6.63 
@@ -5013,7 +5010,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 4, bs = "tp", fx = TRUE)
-<environment: 0xb001860>
+<environment: 0xaac1348>
 
 Estimated degrees of freedom:
 3  total = 4 
@@ -5030,7 +5027,7 @@
 Formula:
 y ~ te(x1, x2, k = c(4, 4), bs = c("cr", "cr"), fx = c(FALSE, 
     FALSE))
-<environment: 0xabcaf90>
+<environment: 0xaa638d0>
 
 Estimated degrees of freedom:
 2.99  total = 3.99 
@@ -5049,7 +5046,7 @@
 Formula:
 y ~ te(x1, x2, k = c(3, 4), bs = c("cs", "cs"), fx = c(TRUE, 
     TRUE))
-<environment: 0xb78ae10>
+<environment: 0xa8be370>
 
 Estimated degrees of freedom:
 11  total = 12 
@@ -5190,7 +5187,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xaf088d8>
+<environment: 0x8b3ea98>
 
 Estimated degrees of freedom:
 8.71  total = 9.71 
@@ -5203,7 +5200,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa776088>
+<environment: 0xa93f6e8>
 
 Estimated degrees of freedom:
 7.18  total = 8.18 
@@ -5216,7 +5213,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa4aaae0>
+<environment: 0x9785868>
 
 Estimated degrees of freedom:
 8.32  total = 9.32 
@@ -5554,7 +5551,7 @@
 Pairwise comparisons:
 (Observed p-value below diagonal, permuted p-value above diagonal)
           grazed ungrazed
-grazed               0.56
+grazed               0.05
 ungrazed 0.04295         
 > 
 > ## Tukey's Honest Significant Differences
@@ -7862,7 +7859,7 @@
 
 Formula:
 y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0xa4436d8>
+<environment: 0x926b0a0>
 
 Estimated degrees of freedom:
 1.28  total = 2.28 
@@ -8418,7 +8415,7 @@
 > ###
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  34.229 8.176 39.961 0 0 
+Time elapsed:  34.698 8.183 40.373 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list