[Vegan-commits] r2469 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Mar 5 19:26:09 CET 2013
Author: jarioksa
Date: 2013-03-05 19:26:09 +0100 (Tue, 05 Mar 2013)
New Revision: 2469
Modified:
pkg/vegan/R/fitted.capscale.R
pkg/vegan/R/goodness.cca.R
pkg/vegan/R/goodness.rda.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/cca.object.Rd
Log:
remove references to u.eig and v.eig items in cca/rda/capscale support function
Modified: pkg/vegan/R/fitted.capscale.R
===================================================================
--- pkg/vegan/R/fitted.capscale.R 2013-03-05 09:01:17 UTC (rev 2468)
+++ pkg/vegan/R/fitted.capscale.R 2013-03-05 18:26:09 UTC (rev 2469)
@@ -6,8 +6,8 @@
type <- match.arg(type)
## Return scaled eigenvalues
U <- switch(model,
- CCA = object$CCA$u.eig,
- CA = object$CA$u.eig,
+ CCA = object$CCA$u %*% diag(sqrt(object$CCA$eig)),
+ CA = object$CA$u %*% diag(sqrt(object$CA$eig)),
Imaginary = object$CA$imaginary.u.eig,
pCCA = object$pCCA$Fit/object$adjust)
## Distances or working scores U
Modified: pkg/vegan/R/goodness.cca.R
===================================================================
--- pkg/vegan/R/goodness.cca.R 2013-03-05 09:01:17 UTC (rev 2468)
+++ pkg/vegan/R/goodness.cca.R 2013-03-05 18:26:09 UTC (rev 2469)
@@ -1,7 +1,7 @@
`goodness.cca` <-
- function (object, display = c("species", "sites"), choices, model = c("CCA",
- "CA"), statistic = c("explained", "distance"), summarize = FALSE,
- ...)
+ function (object, display = c("species", "sites"), choices,
+ model = c("CCA", "CA"), statistic = c("explained", "distance"),
+ summarize = FALSE, ...)
{
model <- match.arg(model)
if (is.null(object$CCA))
@@ -11,11 +11,13 @@
statistic <- match.arg(statistic)
display <- match.arg(display)
cs <- if(display == "species") object$colsum else object$rowsum
+ lambda2 <- sqrt(object[[model]]$eig)
if (display == "species") {
if (is.null(object$CCA))
Xbar <- object$CA$Xbar
else Xbar <- object$CCA$Xbar
- v <- object[[model]]$v.eig
+ v <- object[[model]]$v %*% diag(lambda2)
+ colnames(v) <- colnames(object[[model]]$v)
tot <- diag(crossprod(Xbar))
}
else {
@@ -25,7 +27,8 @@
Xbar <- qr.fitted(object$CCA$QR, Xbar)
tot <- tot + diag(crossprod(t(Xbar)))
}
- v <- object[[model]]$u.eig
+ v <- object[[model]]$u %*% diag(lambda2)
+ colnames(v) <- colnames(object[[model]]$u)
}
if (!missing(choices))
v <- v[, choices, drop = FALSE]
Modified: pkg/vegan/R/goodness.rda.R
===================================================================
--- pkg/vegan/R/goodness.rda.R 2013-03-05 09:01:17 UTC (rev 2468)
+++ pkg/vegan/R/goodness.rda.R 2013-03-05 18:26:09 UTC (rev 2469)
@@ -1,7 +1,7 @@
`goodness.rda` <-
- function (object, display = c("species", "sites"), choices, model = c("CCA",
- "CA"), statistic = c("explained", "distance"), summarize = FALSE,
- ...)
+ function (object, display = c("species", "sites"), choices,
+ model = c("CCA", "CA"), statistic = c("explained", "distance"),
+ summarize = FALSE, ...)
{
model <- match.arg(model)
display <- match.arg(display)
@@ -13,11 +13,13 @@
stop("model ", model, " is not available")
statistic <- match.arg(statistic)
cs <- weights(object, display = display)
+ lambda2 <- sqrt(object[[model]]$eig)
if (display == "species") {
if (is.null(object$CCA))
Xbar <- object$CA$Xbar
else Xbar <- object$CCA$Xbar
- v <- object[[model]]$v.eig
+ v <- object[[model]]$v %*% diag(lambda2)
+ colnames(v) <- colnames(object[[model]]$v)
tot <- diag(crossprod(Xbar)/(nrow(Xbar) - 1))
}
else {
@@ -31,7 +33,8 @@
tot <- tot + diag(crossprod(t(Xbar)))/(nrow(Xbar) -
1)
}
- v <- object[[model]]$u.eig
+ v <- object[[model]]$u %*% diag(lambda2)
+ colnames(v) <- colnames(object[[model]]$u)
}
if (!missing(choices))
v <- v[, choices, drop = FALSE]
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-03-05 09:01:17 UTC (rev 2468)
+++ pkg/vegan/inst/ChangeLog 2013-03-05 18:26:09 UTC (rev 2469)
@@ -4,6 +4,17 @@
Version 2.1-27 (opened Februray 22, 2013)
+ * cca/rda/capscale: removed references to 'u.eig' and 'v.eig'
+ items in support functions. These now use 'u' and 'v' items and
+ scale these with 'eig' (or diag(sqrt(eig))) when needed. This
+ prepares for removing items 'u.eig', 'v.eig' and 'wa.eig' in vegan
+ 2.3 and 2.4. Concerns fitted.capscale, goodness.cca and
+ goodness.rda. The documentation has warned about removing these
+ *.eig items for years, and most vegan functions already avoided
+ using them. We have no idea if any external packages depend on
+ these and therefore we delay the removal till vegan 2.3 and 2.4
+ release.
+
* nestedtemp: function failed if the matrix fill was < 0.38%,
because the fill line parameter was outside the original
estimation bracket. Now bracket is moved up if the estimation
Modified: pkg/vegan/man/cca.object.Rd
===================================================================
--- pkg/vegan/man/cca.object.Rd 2013-03-05 09:01:17 UTC (rev 2468)
+++ pkg/vegan/man/cca.object.Rd 2013-03-05 18:26:09 UTC (rev 2469)
@@ -106,22 +106,30 @@
\code{\link{plot.cca}}, or their \code{rda} variants. Only in
\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. There is no
- guarantee that any \code{.eig} variants of scores will be kept in
- the future releases.}
+
+
+ \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.}
+
+ \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.}
+
+ \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.}
More information about the Vegan-commits
mailing list