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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 9 11:10:02 CET 2015


Author: jarioksa
Date: 2015-03-09 11:10:02 +0100 (Mon, 09 Mar 2015)
New Revision: 2936

Modified:
   pkg/vegan/R/goodness.cca.R
   pkg/vegan/R/goodness.rda.R
   pkg/vegan/inst/NEWS.Rd
   pkg/vegan/man/goodness.cca.Rd
Log:
Merge branch 'cran-2.2' into r-forge-svn-local

Modified: pkg/vegan/R/goodness.cca.R
===================================================================
--- pkg/vegan/R/goodness.cca.R	2015-03-04 11:24:00 UTC (rev 2935)
+++ pkg/vegan/R/goodness.cca.R	2015-03-09 10:10:02 UTC (rev 2936)
@@ -28,9 +28,12 @@
         }
         v <- sweep(object[[model]]$u, 2, lambda2, "*")
     }
+    if (ncol(v) > 1)
+        vexp <- t(apply(v^2, 1, cumsum))
+    else
+        vexp <- v^2
     if (!missing(choices)) 
-        v <- v[, choices, drop = FALSE]
-    vexp <- t(apply(v^2, 1, cumsum))
+        vexp <- vexp[, choices, drop = FALSE]
     if (statistic == "explained") {
         vexp <- sweep(vexp, 1, cs, "*")
         if (!is.null(object$pCCA)) {
@@ -39,7 +42,8 @@
                 Xbar <- t(Xbar)
             ptot <- diag(crossprod(Xbar))
             tot <- tot + ptot
-            vexp <- sweep(vexp, 1, ptot, "+")
+            if (model == "CCA")
+                vexp <- sweep(vexp, 1, ptot, "+")
         }
         vexp <- sweep(vexp, 1, tot, "/")
     }

Modified: pkg/vegan/R/goodness.rda.R
===================================================================
--- pkg/vegan/R/goodness.rda.R	2015-03-04 11:24:00 UTC (rev 2935)
+++ pkg/vegan/R/goodness.rda.R	2015-03-09 10:10:02 UTC (rev 2936)
@@ -15,7 +15,7 @@
     cs <- weights(object, display = display)
     lambda2 <- sqrt(object[[model]]$eig)
     if (display == "species") {
-        if (is.null(object$CCA)) 
+        if (is.null(object$CCA))
             Xbar <- object$CA$Xbar
         else Xbar <- object$CCA$Xbar
         v <- sweep(object[[model]]$v, 2, lambda2, "*")
@@ -34,18 +34,22 @@
         }
         v <- sweep(object[[model]]$u, 2, lambda2, "*")
     }
+    if (ncol(v) > 1)
+        vexp <- t(apply(v^2, 1, cumsum))
+    else
+        vexp <- v^2
+    vexp <- sweep(vexp, 1, cs, "*")
     if (!missing(choices)) 
-        v <- v[, choices, drop = FALSE]
-    vexp <- t(apply(v^2, 1, cumsum))
-    vexp <- sweep(vexp, 1, cs, "*")
+        vexp <- vexp[, choices, drop = FALSE]
     if (statistic == "explained") {
         if (!is.null(object$pCCA)) {
             Xbar <- object$pCCA$Fit
             if (display == "sites") 
                 Xbar <- t(Xbar)
-            ptot <- diag(crossprod(Xbar))
+            ptot <- diag(crossprod(Xbar))/(nrow(Xbar)-1)
             tot <- tot + ptot
-            vexp <- sweep(vexp, 1, ptot, "+")
+            if (model == "CCA")
+                vexp <- sweep(vexp, 1, ptot, "+")
         }
         vexp <- sweep(vexp, 1, tot, "/")
     }

Modified: pkg/vegan/inst/NEWS.Rd
===================================================================
--- pkg/vegan/inst/NEWS.Rd	2015-03-04 11:24:00 UTC (rev 2935)
+++ pkg/vegan/inst/NEWS.Rd	2015-03-09 10:10:02 UTC (rev 2936)
@@ -4,6 +4,30 @@
 
 \section{Changes in version 2.2-2}{
 
+  \subsection{BUG FIXES}{
+    \itemize{
+
+      \item Constrained ordination functions \code{cca}, \code{rda}
+      and \code{capscale} are now more robust. Scoping of data set
+      names and variable names is much improved.
+
+      \item Ordination functions \code{cca} and \code{rda} silently
+      accepted dissimilarities as input although their analysis makes
+      no sense with these methods. Dissimilarities should be analysed
+      with distance-based redundancy analysis (\code{capscale}).
+
+      \item The variance of the conditional component was
+      over-estimated in \code{goodness} of \code{rda} results, and
+      results were wrong for partial RDA. The \code{goodness}
+      functions for \code{cca} and \code{rda} were both redesigned so
+      that the variation of the partial component was only combined
+      with the constrained variance, but not with the unconstrained
+      component. Previously the conditional variation was combined
+      with both components.
+
+    }
+  } % bug fixes
+
   \subsection{NEW FEATURES}{
     \itemize{
 

Modified: pkg/vegan/man/goodness.cca.Rd
===================================================================
--- pkg/vegan/man/goodness.cca.Rd	2015-03-04 11:24:00 UTC (rev 2935)
+++ pkg/vegan/man/goodness.cca.Rd	2015-03-09 10:10:02 UTC (rev 2936)
@@ -51,9 +51,11 @@
 \details{
   Function \code{goodness} gives the diagnostic statistics for species
   or sites. The alternative statistics are the cumulative proportion of
-  inertia accounted for by the axes, and the residual distance left
-  unaccounted for.  The conditional (\dQuote{partialled out}) constraints are
-  always regarded as explained and included in the statistics.
+  inertia accounted for up to the axes, and the residual distance left
+  unaccounted for.  The conditional (\dQuote{partialled out})
+  constraints are always regarded as explained and included in the
+  statistics of the constrained component with\code{model = "CCA"}
+  (but not in the residual component with \code{model = "CA"}).
 
   Function \code{inertcomp} decomposes the inertia into partial,
   constrained and unconstrained components for each site or



More information about the Vegan-commits mailing list