[Vegan-commits] r884 - in pkg/vegan: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jul 4 08:56:07 CEST 2009
Author: jarioksa
Date: 2009-07-04 08:56:07 +0200 (Sat, 04 Jul 2009)
New Revision: 884
Modified:
pkg/vegan/DESCRIPTION
pkg/vegan/R/wcmdscale.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/wcmdscale.Rd
Log:
wcmdscale: returns scaled axes with negative eigenvalues
Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION 2009-06-29 06:04:44 UTC (rev 883)
+++ pkg/vegan/DESCRIPTION 2009-07-04 06:56:07 UTC (rev 884)
@@ -1,7 +1,7 @@
Package: vegan
Title: Community Ecology Package
-Version: 1.16-20
-Date: June 17, 2009
+Version: 1.16-21
+Date: July 4, 2009
Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson,
Peter Solymos, M. Henry H. Stevens, Helene Wagner
Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
Modified: pkg/vegan/R/wcmdscale.R
===================================================================
--- pkg/vegan/R/wcmdscale.R 2009-06-29 06:04:44 UTC (rev 883)
+++ pkg/vegan/R/wcmdscale.R 2009-07-04 06:56:07 UTC (rev 884)
@@ -27,16 +27,23 @@
keep <- abs(e$values) > ZERO
e$values <- e$values[keep]
e$vectors <- e$vectors[, keep]
- ## Get number of positive eigenvalues
- if (missing(k))
+ ## Deweight and scale axes -- also negative
+ points <- sweep(e$vectors, 1, sqrt(w), "/")
+ points <- sweep(points, 2, sqrt(abs(e$values)), "*")
+ rownames(points) <- rownames(m)
+ ## If 'k' not given, find it as the number of positive
+ ## eigenvalues, and also save negative eigenvalues
+ negaxes <- NULL
+ if (missing(k) || k > sum(e$values > ZERO)) {
k <- sum(e$values > ZERO)
- ev <- e$values[1:k]
- points <- sweep(e$vectors[, 1:k, drop=FALSE], 1, sqrt(w), "/")
- points <- sweep(points, 2, sqrt(ev), "*")
- rownames(points) <- rownames(m)
+ if (any(e$values < 0))
+ negaxes <- points[, e$values < 0, drop = FALSE]
+ }
+ points <- points[, 1:k, drop=FALSE]
if (eig || x.ret || add) {
out <- list(points = points, eig = if (eig) e$values,
- x = if (x.ret) m, ac = NA, GOF = NA, weights = w)
+ x = if (x.ret) m, ac = NA, GOF = NA, weights = w,
+ negaxes = negaxes)
class(out) <- "wcmdscale"
}
else out <- points
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-06-29 06:04:44 UTC (rev 883)
+++ pkg/vegan/inst/ChangeLog 2009-07-04 06:56:07 UTC (rev 884)
@@ -2,8 +2,14 @@
VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
-Versin 1.16-20 (opened June 17, 2009)
+Version 1.16-21 (opened July 4, 2009)
+ * wcmdscale: returns negative eigevalues scaled by
+ sqrt(abs(eigenvalues)) if 'k' is not given or 'k' would include
+ any negative eigenvalue.
+
+Version 1.16-20 (closed July 4, 2009)
+
* new version opened concurrently with the release of vegan 1.15-3
on June 17, 2009.
Modified: pkg/vegan/man/wcmdscale.Rd
===================================================================
--- pkg/vegan/man/wcmdscale.Rd 2009-06-29 06:04:44 UTC (rev 883)
+++ pkg/vegan/man/wcmdscale.Rd 2009-07-04 06:56:07 UTC (rev 884)
@@ -48,6 +48,9 @@
\code{eig} is true.}
\item{x}{the doubly centred and weighted distance matrix if \code{x.ret} is true.}
\item{weights}{Weights.}
+ \item{negaxes}{A matrix of scores for axes with negative eigenvalues scaled
+ by the absolute eigenvalues similarly as \code{points}. This is \code{NULL}
+ if there are no negative eigenvalues or \code{k} was specified, and would not include negative eigenvalues.}
}
\references{
Gower, J. C. (1966)
More information about the Vegan-commits
mailing list