[Vegan-commits] r2617 - in branches/2.0: R inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 11 10:59:36 CEST 2013


Author: jarioksa
Date: 2013-09-11 10:59:36 +0200 (Wed, 11 Sep 2013)
New Revision: 2617

Modified:
   branches/2.0/R/as.mlm.cca.R
   branches/2.0/R/as.mlm.rda.R
   branches/2.0/R/capscale.R
   branches/2.0/R/eigenvals.R
   branches/2.0/R/intersetcor.R
   branches/2.0/R/print.vectorfit.R
   branches/2.0/inst/ChangeLog
   branches/2.0/man/varpart.Rd
   branches/2.0/vignettes/FAQ-vegan.texi
Log:
merge small edits to vegan 2.0-9

r2592: varpart.Rd gives more detailed explanations
r2598: remove workarounds for R <= 2.12.0 (we depend now on R 2.14.0)
r2599: remove workaround for R <= 2.13.0
r2600: print.vectorfit zaps zeros
r2605,7: FAQ about La.svd errors in cca/rda/capscale.


Modified: branches/2.0/R/as.mlm.cca.R
===================================================================
--- branches/2.0/R/as.mlm.cca.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/as.mlm.cca.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -5,10 +5,6 @@
     wa <- x$CCA$wa
     wa <- sweep(wa, 1, sqrt(w), "*")
     X <- qr.X(x$CCA$QR)
-    ## qr.X gives wrong column names now, and they are fixed here
-    ## (hopefully fixed in 2.12.1, but that's only a wish).
-    if (getRversion() <= "2.12.0")
-        colnames(X)[x$CCA$QR$pivot] <- colnames(X)
     lm(wa ~ . - 1, data = as.data.frame(X))
 }
 

Modified: branches/2.0/R/as.mlm.rda.R
===================================================================
--- branches/2.0/R/as.mlm.rda.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/as.mlm.rda.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -2,10 +2,6 @@
     function (x) 
 {
     X <- qr.X(x$CCA$QR)
-    ## We hope that column names will be fixed in R 2.12.1 (but
-    ## perhaps in vain).
-    if (getRversion() <= "2.12.0")
-        colnames(X)[x$CCA$QR$pivot] <- colnames(X)
     lm(x$CCA$wa ~ . - 1, data = as.data.frame(X))
 }
 

Modified: branches/2.0/R/capscale.R
===================================================================
--- branches/2.0/R/capscale.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/capscale.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -79,8 +79,6 @@
     if (add) {
         X <- cmdscale(X, k = k, eig = TRUE, add = add)
         ## All eigenvalues *should* be positive, but see that they are
-        if (getRversion() < "2.13.0")
-            X$points <- X$points[, X$eig[-(k+1)] > 0]
         X$eig <- X$eig[X$eig > 0]
     }
     else

Modified: branches/2.0/R/eigenvals.R
===================================================================
--- branches/2.0/R/eigenvals.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/eigenvals.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -20,8 +20,7 @@
         else if (length(x) == 3 && all(names(x) %in% c("d", "u", "v")))
             out <- x$d^2
         ## cmdscale() will return all eigenvalues from R  2.12.1
-        else if (getRversion() > "2.12.0" &&
-                 all(c("points","eig","GOF") %in% names(x)))
+        else if (all(c("points","eig","GOF") %in% names(x)))
             out <- x$eig
     }
     class(out) <- "eigenvals"

Modified: branches/2.0/R/intersetcor.R
===================================================================
--- branches/2.0/R/intersetcor.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/intersetcor.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -8,8 +8,5 @@
         wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
     }
     X <- qr.X(object$CCA$QR)
-    ## current R (2.12.0) uses wrong column names in pivoted qr.X()
-    if (getRversion() <= "2.12.0")
-        colnames(X)[object$CCA$QR$pivot] <- colnames(X)
     cor(X, wa)
 }

Modified: branches/2.0/R/print.vectorfit.R
===================================================================
--- branches/2.0/R/print.vectorfit.R	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/R/print.vectorfit.R	2013-09-11 08:59:36 UTC (rev 2617)
@@ -1,8 +1,9 @@
-"print.vectorfit" <-
+`print.vectorfit` <-
     function (x, ...) 
 {
     out <- cbind(x$arrows, r2 = x$r, "Pr(>r)" = x$pvals)
-    printCoefmat(out, na.print = "", ...)
+    printCoefmat(out, na.print = "",
+                 zap.ind = seq_len(ncol(out)-2), ...)
     if (x$permutations) {
         cat("P values based on", x$permutations, "permutations")
         if (!is.null(x$strata)) 

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/inst/ChangeLog	2013-09-11 08:59:36 UTC (rev 2617)
@@ -5,10 +5,15 @@
 Version 2.0-9 (opened August 23, 2013)
 
 	* merge 2613: 'medoid' to 'median' in betadisper output and doc.
+	* merge 2605, 7: FAQ about La.svd errors in cca/rda/capscale.
+	* merge 2604: print.vectorfit zaps zeros.
 	* merge 2600: remove tools::: in vegandocs().
+	* merge 2599: remove workarounds for R <= 2.13.0.
+	* merge 2598: remove workarounds for R <= 2.12.0.
 	* merge 2597: move vignettes from inst/doc to vignettes/; depend
 	on R 2.14.0.
 	* merge 2593: remove stats::: in anova.ccabyaxis().
+	* merge 2592: expand varpart.Rd to avoid questions.
 	* merge 2590: typos.
 	* merge r2588: remove unneeded utils::: in vegandocs (some remain). 
 	* merge 2584,6: vegan Depends on lattice, avoid lattice:::

Modified: branches/2.0/man/varpart.Rd
===================================================================
--- branches/2.0/man/varpart.Rd	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/man/varpart.Rd	2013-09-11 08:59:36 UTC (rev 2617)
@@ -10,12 +10,13 @@
 
 \title{Partition the Variation of Community Matrix by 2, 3, or 4 Explanatory Matrices }
 
-\description{ The function partitions the variation of response table Y
-with respect to two, three, or four explanatory tables, using
-redundancy analysis ordination (RDA). If Y contains a single
-vector, partitioning is by partial regression.  Collinear variables in the 
-explanatory tables do NOT have to be removed prior to 
-partitioning.
+\description{ 
+  The function partitions the variation of response table Y with
+  respect to two, three, or four explanatory tables, using adjusted
+  \eqn{R^2}{R-squared} in redundancy analysis ordination (RDA). If Y
+  contains a single vector, partitioning is by partial regression.
+  Collinear variables in the explanatory tables do NOT have to be
+  removed prior to partitioning.  
 }
 
 \usage{
@@ -65,17 +66,14 @@
   effects. If \code{Y} is a multicolumn data frame or
   matrix, the partitioning is based on redundancy analysis (RDA, see
   \code{\link{rda}}), and if \code{Y} is a single variable, the
-  partitioning is based on linear regression.   A simplified, fast
-  version of RDA is used (function \code{simpleRDA2}).  The actual
-  calculations are done in functions \code{varpart2} to \code{varpart4},
-  but these are not intended to be called directly by the user. 
+  partitioning is based on linear regression.  
 
-  The function primarily uses adjusted R squares to assess the partitions
-  explained by the explanatory tables and their combinations, because
-  this is the only unbiased method (Peres-Neto
-  et al., 2006). The raw R squares for basic fractions are also
-  displayed, but these are biased estimates of variation explained by
-  the explanatory table.
+  The function primarily uses adjusted \eqn{R^2}{R-squared} to assess
+  the partitions explained by the explanatory tables and their
+  combinations, because this is the only unbiased method (Peres-Neto
+  et al., 2006). The raw \eqn{R^2}{R-squared} for basic fractions are
+  also displayed, but these are biased estimates of variation
+  explained by the explanatory table. 
 
   The identifiable fractions are designated by lower case alphabets. The
   meaning of the symbols can be found in the separate document
@@ -151,9 +149,9 @@
   \itemize{
   \item{Df}{Degrees of freedom of numerator of the \eqn{F}-statistic
     for the fraction.}
-  \item{R.square}{Raw R-squared.  This is calculated only for
+  \item{R.square}{Raw \eqn{R^2}{R-squared}. This is calculated only for
     \code{fract} and this is \code{NA} in other items.}
-  \item{Adj.R.square}{Adjusted R-squared.}
+  \item{Adj.R.square}{Adjusted \eqn{R^2}{R-squared}.}
   \item{Testable}{If the fraction can be expressed as a (partial) RDA
     model, it is directly \code{Testable}, and this field is
     \code{TRUE}.  In that case the fraction label also gives the
@@ -186,35 +184,47 @@
 \author{ Pierre Legendre, Departement de Sciences Biologiques, Universite de
 Montreal, Canada.  Adapted to \pkg{vegan} by Jari Oksanen. }
 
-\note{You can use command \code{\link{vegandocs}} to display document
-  "partitioning.pdf"  which  presents
-Venn diagrams showing the fraction names in partitioning the variation of
-Y with respect to 2, 3, and 4 tables of explanatory variables, as well
-as the equations used in variation partitioning.
+\note{
 
-The functions frequently give negative estimates of variation.  Adjusted
-R-squares can be negative for any fraction; 
-unadjusted R squares of testable fractions always will be non-negative.
-Non-testable fractions cannot be found directly, but by subtracting
-different models, and these subtraction results can be negative.
-The fractions are orthogonal, or linearly independent, but more
-complicated or nonlinear dependencies can cause negative non-testable
-fractions. 
+  You can use command \code{\link{vegandocs}} to display document
+  "partitioning.pdf" which presents Venn diagrams showing the fraction
+  names in partitioning the variation of Y with respect to 2, 3, and 4
+  tables of explanatory variables, as well as the equations used in
+  variation partitioning.
 
-The current function will only use RDA in multivariate partitioning. It
-is much more complicated to estimate the adjusted R-squares for CCA, and
-unbiased analysis of CCA is not currently implemented.
+  The functions frequently give negative estimates of variation.
+  Adjusted \eqn{R^2}{R-squared} can be negative for any fraction;
+  unadjusted \eqn{R^2}{R-squared} of testable fractions always will be
+  non-negative.  Non-testable fractions cannot be found directly, but
+  by subtracting different models, and these subtraction results can
+  be negative.  The fractions are orthogonal, or linearly independent,
+  but more complicated or nonlinear dependencies can cause negative
+  non-testable fractions.
+
+  The current function will only use RDA in multivariate
+  partitioning. It is much more complicated to estimate the adjusted
+  R-squares for CCA, and unbiased analysis of CCA is not currently
+  implemented.
+
+  A simplified, fast version of RDA is used (function
+  \code{simpleRDA2}).  The actual calculations are done in functions
+  \code{varpart2} to \code{varpart4}, but these are not intended to be
+  called directly by the user.
+
 }
 
-\seealso{
+\seealso{ 
   For analysing testable fractions, see \code{\link{rda}} and
   \code{\link{anova.cca}}. For data transformation, see
   \code{\link{decostand}}. Function \code{\link{inertcomp}} gives
   (unadjusted) components of variation for each species or site
-  separately.  
- }
+  separately.  Function \code{\link{rda}} displays unadjusted
+  components in its output, but \code{\link{RsquareAdj}} will give
+  adjusted \eqn{R^2}{R-squared} that are similar to the current
+  function also for partial models.  
+}
 
- \examples{
+\examples{
 data(mite)
 data(mite.env)
 data(mite.pcnm)

Modified: branches/2.0/vignettes/FAQ-vegan.texi
===================================================================
--- branches/2.0/vignettes/FAQ-vegan.texi	2013-09-11 08:34:17 UTC (rev 2616)
+++ branches/2.0/vignettes/FAQ-vegan.texi	2013-09-11 08:59:36 UTC (rev 2617)
@@ -334,6 +334,7 @@
 * Where can I find numerical scores of ordination axes?::  
 * How the RDA results are scaled?::  
 * cca fails with ``data.frame expected'' or ``"site.env" missing''::  
+* Ordination fails with ``Error in La.svd''::  
 * Variance explained by ordination axes::  
 * Can I have random effects in constrained ordination or in @code{adonis}?::  
 * Is it possible to have passive points in ordination?::  
@@ -478,7 +479,7 @@
 implementation details in vegan'' that you can read with @pkg{vegan}
 command @code{vegandocs("decision")}.
 
- at node cca fails with ``data.frame expected'' or ``"site.env" missing'', Variance explained by ordination axes, How the RDA results are scaled?, Ordination
+ at node cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination fails with ``Error in La.svd'', How the RDA results are scaled?, Ordination
 @section cca fails with ``data.frame expected'' or ``"site.env" missing''
 
 This is not a @pkg{vegan} error message, but it comes from the
@@ -489,7 +490,29 @@
 you do not need package @pkg{ade4}, you can detach it with command
 @code{detach(package:ade4)}.
 
- at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
+ at node Ordination fails with ``Error in La.svd'', Variance explained by ordination axes, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
+ at section Ordination fails with ``Error in La.svd''
+
+Constrained ordination (@code{cca}, @code{rda}, @code{capscale}) will
+sometimes fail with error message 
+ at code{Error in La.svd(x, nu, nv): error code 1 from Lapack routine 'dgesdd'.}  
+
+It seems that the basic problem is in the @code{svd} function of
+ at code{LAPACK} that is used for numerical analysis in R.  @code{LAPACK}
+is an external library that is beyond the control of package developers
+and R core team so that these problems may be unsolvable. It seems that
+the problems with the @code{LAPACK} code are so common that even the
+help page of @code{svd} warns about them
+
+Reducing the range of constraints (environmental variables) helps
+sometimes. For instance, multiplying constraints by a constant < 1. This
+rescaling does not influence the numerical results of constrained
+ordination, but it can complicate further analyses when values of
+constraints are needed, because the same scaling must be applied
+there. We can only hope that this problem is fixed in the future
+versions of R and @code{LAPACK}.
+
+ at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, Ordination fails with ``Error in La.svd'', Ordination
 @section Variance explained by ordination axes.
 
 In general, @pkg{vegan} does not directly give any statistics on the



More information about the Vegan-commits mailing list