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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 8 09:43:05 CEST 2014


Author: jarioksa
Date: 2014-10-08 09:43:04 +0200 (Wed, 08 Oct 2014)
New Revision: 2895

Modified:
   pkg/vegan/R/ade2vegancca.R
   pkg/vegan/R/capscale.R
   pkg/vegan/R/cca.default.R
   pkg/vegan/R/rda.default.R
   pkg/vegan/inst/NEWS.Rd
   pkg/vegan/man/cca.object.Rd
Log:
Squashed commit of the following:

commit 16d74e39dd745c445cb862aae860ddbc83d25a57
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Oct 7 21:06:02 2014 +0300

    skeleton of NEWS about vegan 2.2-0

commit 70e5542754fbf3c67cf55bc19db42b61708ec0b8
Merge: ea6dcea 54aa57f
Author: Gavin Simpson <ucfagls at gmail.com>
Date:   Tue Oct 7 08:37:56 2014 -0600

    Merge pull request #51 from jarioksa/remove-u.eig-etc

    Remove u.eig etc

commit 54aa57fa08c06424a8d0ad7aa4575f5de52352e0
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 20:15:40 2014 +0300

    man/cca.object tells about imaginary.u.eig scores in capscale

commit 971a7f602364109e13cfb21e21216c067c6f8cf8
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 08:44:48 2014 +0300

    man/cca.object.Rd updated to new cca object without .eig scores

    There is a note about changes which here are suggested to be
    effective in vegan 2.2-0.

commit c4ab85b43a13d0ac1a61aae7ac9c63e60b494368
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 08:43:46 2014 +0300

    neither ade2vegancca returns u.eig, v.eig, wa.eig

commit 5f33e5be3092f5102d4e7b33d11990a66fa3b8e6
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 08:39:38 2014 +0300

    remove v.eig item from capscale result

    wa.eig and u.eig already disappeared with rda changes.

    The result still has CA$imaginary.u.eig (scaled scores for
    imaginary axes). These are the only scores returned for
    imaginary axes.

commit 96d8bdf0695ac0254b8233fb48f585a764130251
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 08:14:13 2014 +0300

    remove u.eig etc from rda

commit 761afcb0a6895a530b74334f0ffa0c727483b425
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Oct 5 07:56:11 2014 +0300

    remove u.eig, v.eig and wa.eig items from cca.default

    The cca.object was documented in vegan 1.6-10 (Sep 26, 2005), and
    in that document we warn that there is "no guarantee" that these
    itmems will be kept in future release. In commit bddfea39 (Mar 5, 2013)
    we use harsher tone and said that the "item will be removed". However,
    that harsher text has not been in any release version so that this
    may be an abrupt change.

Modified: pkg/vegan/R/ade2vegancca.R
===================================================================
--- pkg/vegan/R/ade2vegancca.R	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/R/ade2vegancca.R	2014-10-08 07:43:04 UTC (rev 2895)
@@ -1,4 +1,3 @@
-
 `ade2vegancca` <-
     function(object)
 {
@@ -6,16 +5,14 @@
     CCA <- list(eig = object$eig,
                 u = as.matrix(object$l1),
                 v = as.matrix(object$c1),
-                u.eig = as.matrix(object$li),
-                v.eig = as.matrix(object$co),
-                wa.eig = as.matrix(object$ls),
+                wa = sweep(as.matrix(object$ls), 2,
+                           1/sqrt(object$eig[1:nf]), "*"),
                 biplot = as.matrix(object$cor)[-1,],
                 rank = object$rank,
                 tot.chi = sum(object$eig),
                 QR = NA,
                 envcentre = NA,
                 Xbar = NA)
-    CCA$wa <- sweep(CCA$wa.eig, 2, 1/sqrt(object$eig[1:nf]), "*")
     out <- list(call = object$call,
                 grand.total = NA,
                 rowsum = object$lw,

Modified: pkg/vegan/R/capscale.R
===================================================================
--- pkg/vegan/R/capscale.R	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/R/capscale.R	2014-10-08 07:43:04 UTC (rev 2895)
@@ -124,20 +124,20 @@
         if (!is.null(sol$pCCA) && sol$pCCA$rank > 0) 
             comm <- qr.resid(sol$pCCA$QR, comm)
         if (!is.null(sol$CCA) && sol$CCA$rank > 0) {
-            sol$CCA$v.eig <- t(comm) %*% sol$CCA$u/sqrt(k)
-            sol$CCA$v <- decostand(sol$CCA$v.eig, "normalize", MARGIN = 2)
+            v.eig <- t(comm) %*% sol$CCA$u/sqrt(k)
+            sol$CCA$v <- decostand(v.eig, "normalize", MARGIN = 2)
             comm <- qr.resid(sol$CCA$QR, comm)
         }
         if (!is.null(sol$CA) && sol$CA$rank > 0) {
-            sol$CA$v.eig <- t(comm) %*% sol$CA$u/sqrt(k)
-            sol$CA$v <- decostand(sol$CA$v.eig, "normalize", MARGIN = 2)
+            v.eig <- t(comm) %*% sol$CA$u/sqrt(k)
+            sol$CA$v <- decostand(v.eig, "normalize", MARGIN = 2)
         }
     } else {
         ## input data were dissimilarities, and no 'comm' defined:
         ## species scores make no sense and are made NA
-        sol$CA$v.eig[] <- sol$CA$v[] <- NA
+        sol$CA$v[] <- NA
         if (!is.null(sol$CCA))
-            sol$CCA$v.eig[] <- sol$CCA$v[] <- NA
+            sol$CCA$v[] <- NA
         sol$colsum <- NA
     }
     if (!is.null(sol$CCA) && sol$CCA$rank > 0) 

Modified: pkg/vegan/R/cca.default.R
===================================================================
--- pkg/vegan/R/cca.default.R	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/R/cca.default.R	2014-10-08 07:43:04 UTC (rev 2895)
@@ -68,11 +68,9 @@
                            1, 1/sqrt(rowsum), "*")
             CCA$v <- sweep(as.matrix(sol$v[, 1:rank, drop = FALSE]), 
                            1, 1/sqrt(colsum), "*")
-            CCA$u.eig <- sweep(CCA$u, 2, sol$d[1:rank], "*")
-            CCA$v.eig <- sweep(CCA$v, 2, sol$d[1:rank], "*")
-            CCA$wa.eig <- sweep(Xbar %*% sol$v[, 1:rank, drop = FALSE], 
-                                1, 1/sqrt(rowsum), "*")
-            CCA$wa <- sweep(CCA$wa.eig, 2, 1/sol$d[1:rank], "*")
+            wa.eig <- sweep(Xbar %*% sol$v[, 1:rank, drop = FALSE], 
+                            1, 1/sqrt(rowsum), "*")
+            CCA$wa <- sweep(wa.eig, 2, 1/sol$d[1:rank], "*")
             oo <- Q$pivot
             if (!is.null(pCCA$rank)) 
                 oo <- oo[-(1:pCCA$rank)] - ncol(Z.r)
@@ -92,15 +90,14 @@
                         QR = Q, Xbar = Xbar)
             u <- matrix(0, nrow=nrow(sol$u), ncol=0)
             v <- matrix(0, nrow=nrow(sol$v), ncol=0)
-            CCA$u <- CCA$u.eig <- CCA$wa <- CCA$wa.eig <- u
-            CCA$v <- CCA$v.eig <- v
+            CCA$u <- CCA$wa <- u
+            CCA$v <- v
             CCA$biplot <- matrix(0, 0, 0)
             CCA$alias <- colnames(Y.r)
         }
         Xbar <- qr.resid(Q, Xbar)
         if (exists("exclude.spec")) {
             attr(CCA$v, "na.action") <- exclude.spec
-            attr(CCA$v.eig, "na.action") <- exclude.spec
         }
         
     }
@@ -119,8 +116,6 @@
                       1, 1/sqrt(rowsum), "*")
         CA$v <- sweep(as.matrix(sol$v[, 1:rank, drop = FALSE]), 
                       1, 1/sqrt(colsum), "*")
-        CA$u.eig <- sweep(CA$u, 2, sol$d[1:rank], "*")
-        CA$v.eig <- sweep(CA$v, 2, sol$d[1:rank], "*")
         CA$rank <- rank
         CA$tot.chi <- sum(CA$eig)
         CA$Xbar <- Xbar
@@ -128,12 +123,11 @@
     } else {   # zero rank: no residual component
         CA <- list(eig = 0, rank = rank, tot.chi = 0,
                    Xbar = Xbar)
-        CA$u <- CA$u.eig <- matrix(0, nrow(sol$u), 0)
-        CA$v <- CA$v.eig <- matrix(0, nrow(sol$v), 0)
+        CA$u <- matrix(0, nrow(sol$u), 0)
+        CA$v <- matrix(0, nrow(sol$v), 0)
     }
     if (exists("exclude.spec")) {
         attr(CA$v, "na.action") <- exclude.spec
-        attr(CA$v.eig, "na.action") <- exclude.spec
     }
     call <- match.call()
     call[[1]] <- as.name("cca")

Modified: pkg/vegan/R/rda.default.R
===================================================================
--- pkg/vegan/R/rda.default.R	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/R/rda.default.R	2014-10-08 07:43:04 UTC (rev 2895)
@@ -51,13 +51,9 @@
             CCA <- list(eig = sol$d[1:rank]^2)
             CCA$u <- as.matrix(sol$u)[, 1:rank, drop = FALSE]
             CCA$v <- as.matrix(sol$v)[, 1:rank, drop = FALSE]
-            CCA$u.eig <- sweep(as.matrix(CCA$u), 2, sol$d[1:rank], 
-                               "*")
-            CCA$v.eig <- sweep(as.matrix(CCA$v), 2, sol$d[1:rank], 
-                               "*")
-            CCA$wa.eig <- Xbar %*% sol$v[, 1:rank, drop = FALSE]
-            CCA$wa.eig <- CCA$wa.eig/sqrt(NR)
-            CCA$wa <- sweep(CCA$wa.eig, 2, 1/sol$d[1:rank], "*")
+            wa.eig <- Xbar %*% sol$v[, 1:rank, drop = FALSE]
+            wa.eig <- wa.eig/sqrt(NR)
+            CCA$wa <- sweep(wa.eig, 2, 1/sol$d[1:rank], "*")
             oo <- Q$pivot
             if (!is.null(pCCA$rank)) 
                 oo <- oo[-(1:pCCA$rank)] - ncol(Z.r)
@@ -78,8 +74,8 @@
                         QR = Q, Xbar = Xbar)
             u <- matrix(0, nrow=nrow(sol$u), ncol=0)
             v <- matrix(0, nrow=nrow(sol$v), ncol=0)
-            CCA$u <- CCA$u.eig <- CCA$wa <- CCA$wa.eig <- u
-            CCA$v <- CCA$v.eig <- v
+            CCA$u <- CCA$wa <- u
+            CCA$v <- v
             CCA$biplot <- matrix(0, 0, 0)
             CCA$alias <- colnames(Y.r)
         }
@@ -98,18 +94,14 @@
         CA <- list(eig = (sol$d[1:rank]^2))
         CA$u <- as.matrix(sol$u)[, 1:rank, drop = FALSE]
         CA$v <- as.matrix(sol$v)[, 1:rank, drop = FALSE]
-        CA$u.eig <- sweep(as.matrix(CA$u), 2, sol$d[1:rank], 
-                          "*")
-        CA$v.eig <- sweep(as.matrix(CA$v), 2, sol$d[1:rank], 
-                          "*")
         CA$rank <- rank
         CA$tot.chi <- sum(CA$eig)
         CA$Xbar <- Xbar
     } else {   # zero rank: no residual component
         CA <- list(eig = 0, rank = rank, tot.chi = 0,
                    Xbar = Xbar)
-        CA$u <- CA$u.eig <- matrix(0, nrow(sol$u), 0)
-        CA$v <- CA$v.eig <- matrix(0, nrow(sol$v), 0)
+        CA$u <- matrix(0, nrow(sol$u), 0)
+        CA$v <- matrix(0, nrow(sol$v), 0)
     }
     call <- match.call()
     call[[1]] <- as.name("rda")

Modified: pkg/vegan/inst/NEWS.Rd
===================================================================
--- pkg/vegan/inst/NEWS.Rd	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/inst/NEWS.Rd	2014-10-08 07:43:04 UTC (rev 2895)
@@ -2,6 +2,120 @@
 \title{vegan News}
 \encoding{UTF-8}
 
+\section{Changes in version 2.2-0}{
+
+  \subsection{GENERAL}{
+    \itemize{
+  
+      \item Parallel processing
+
+      \item Restricted permutations
+
+      \item New null models   
+  
+    } %end itemize
+  } % end general
+
+  \subsection{INSTALLATION}{
+    \itemize{
+
+      \item Changes in NAMESPACE and passes tests
+
+      \item Split \pkg{vegan3d}
+
+     } %end itemize
+   } % end installation
+
+  \subsection{NEW FUNCTIONS}{
+    \itemize{
+
+      \item Dispersion weighting \code{dispweight} plus a new method
+      for generalized dispersion weigthing \code{gdispweight}.
+
+      \item \code{hclust} support functions \code{reorder}, \code{rev}
+      and \code{scores}.
+
+      \item \code{permustats} to extract and inspect permutation
+      results with support functions \code{summary}, \code{density},
+      \code{densityplot}, \code{qqnorm} and \code{qqmath}.
+
+      \item \code{stressplot} functions.
+
+    } % end itemize
+  } % end new functions
+
+  \subsection{BUG FIXES}{
+  } % end bug fixes
+
+  \subsection{NEW FEATURES}{
+    \itemize{
+
+      \item \code{anova.cca} functions re-written, and added an option
+      of analysing a sequence of models against each other.
+
+      \item \code{simulate} functions for \code{cca} and \code{rda}
+      can return several simulations in a \code{nullmodel} compatible
+      object. The functions can produce simulations with correlated
+      errors (also for \code{capscale}).
+
+      \item \code{bioenv} can use Manhattan, Gower and Mahalanobis
+      distances in addition to Euclidean. New helper function
+      \code{bioenvdist} can extract the dissimilarities applied in
+      best model or any other model.
+
+      \item \code{MDSrotate} can rotate to multidimensional target.
+
+      \item \code{nestednodf} gained new option for defining weighted
+      nestedness statistic.
+
+      \item \code{rankindex} can use Manhattan, Gower and Mahalanobis
+      distance in addition to Euclidean.
+
+      \item \code{spantree} gained a support function \code{as.hclust}
+      to change the minimum spannig tree into an \code{hclust} tree.
+
+      \item \code{fitspecaccum} can do weighted analysis.
+
+      \item \code{vegdist} gained Mahalanobis distance.
+
+      \item Nomenclature updated in plant community
+      data. \code{varespec} and \code{dune} use 8-character names (4
+      from genus + 4 from species epithet). New data set on
+      phylogenetic distances for \code{dune}.
+
+      \item User configurable plots for \code{rarecurve}.
+
+    } %end itemize
+  } % end new features
+
+  \subsection{DEPRECATED AND DEFUNCT}{
+    \itemize{
+
+      \item \code{strata} deprecated in permutations. It is still
+      accepted but will be phased out in next releases. Use \code{how}
+      of \pkg{permute} package.
+
+      \item \code{cca}, \code{rda} and \code{capscale} do not return
+      scores scaled by eigenvalues: use \code{scores} function to
+      extract scaled results.
+
+      \item \code{commsimulator} is deprecated. Replace
+      \code{commsimulator(x, method)} with \code{simulate(nullmodel(x,
+      method))}.
+
+      \item \code{density} and \code{densityplot} for permutation
+      results: use \code{density(permustats(<permutation-object))}.
+
+      \item \code{ordirgl} with its support functions, other \pkg{rgl}
+      functions and \code{ordiplot3d} were moved to the \pkg{vegan3d}
+      package.
+
+    } %end itemize
+  } % end deprecated
+  
+
+} % end version 2.2-0
+
 \section{Changes in version 2.0-10}{
 
   \subsection{GENERAL}{

Modified: pkg/vegan/man/cca.object.Rd
===================================================================
--- pkg/vegan/man/cca.object.Rd	2014-10-07 18:18:56 UTC (rev 2894)
+++ pkg/vegan/man/cca.object.Rd	2014-10-08 07:43:04 UTC (rev 2895)
@@ -95,10 +95,11 @@
      \code{CCA} components. Only in \code{CCA}.}
     \item{\code{tot.chi}}{Total inertia or the sum of all eigenvalues of the
       component.}
-    \item{\code{imaginary.chi}, \code{imaginary.rank}}{The sum and
-     rank (number) of negative eigenvalues in
-     \code{\link{capscale}}. Only in \code{CA} and only if negative
-     eigenvalues were found in \code{\link{capscale}}.}
+    \item{\code{imaginary.chi}, \code{imaginary.rank},
+     \code{imaginary.u.eig}}{The sum, rank (number) of negative
+     eigenvalues and scaled site scores for imaginary axes in
+     \code{\link{capscale}}. Only in \code{CA} item and only if
+     negative eigenvalues were found in \code{\link{capscale}}.}
     \item{\code{u}}{(Weighted) orthonormal site scores.  Please note that
       scaled scores are not stored in the \code{cca} object, but they
       are made when the object is accessed with functions like
@@ -107,29 +108,17 @@
       \code{CCA} and \code{CA}.  In the \code{CCA} component these are
       the so-called linear combination scores. }
     
-     
-    \item{\code{u.eig}}{\code{u} scaled by eigenvalues.  This item
-      will be removed in future releases.}
-    
     \item{\code{v}}{(Weighted) orthonormal species scores.  If missing species
       were omitted from the analysis, this will contain
       attribute \code{\link{na.action}} that lists the
       omitted species. Only in \code{CCA} and \code{CA}.}
     
-    \item{\code{v.eig}}{\code{v} weighted by eigenvalues.  This item will
-       be removed in future releases.}
-    
     \item{\code{wa}}{Site scores found as weighted averages (\code{cca}) or
       weighted sums (\code{rda}) of 
       \code{v} with weights \code{Xbar}, but the multiplying effect of
       eigenvalues  removed. These often are known as WA scores in
       \code{cca}. Only in  \code{CCA}.}
 
-    \item{\code{wa.eig}}{The direct result of weighted averaging or
-      weighted summation (matrix multiplication) with the resulting
-      eigenvalue inflation. This item will be removed in future
-      releases.}
-
     \item{\code{wa.excluded, u.excluded}}{WA scores for rows removed by
       \code{na.action = na.exclude} in \code{CCA} and \code{CA}
       components if these could be calculated.}
@@ -184,6 +173,16 @@
       \code{\link{capscale}}, section \dQuote{Notes}.}
   }
 }
+
+\note{
+  In old versions of \pkg{vegan} the object also included scores
+  scaled by eigenvalues (\code{u.eig}, \code{v.eig} and \code{wa.eig}),
+  but these were removed in \pkg{vegan} 2.2-0. The scores are scaled
+  when they are accessed with \code{\link{scores}} function. It is
+  advisable to always use \code{\link{scores}} in accessing the
+  results instead of directly accessing the elements of the the
+  \code{cca} object.
+}
   
 \seealso{The description here provides a hacker's interface.  User
   level functions for further analysis and handling of \code{cca}



More information about the Vegan-commits mailing list