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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Oct 15 19:27:32 CEST 2010


Author: jarioksa
Date: 2010-10-15 19:27:31 +0200 (Fri, 15 Oct 2010)
New Revision: 1333

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/eigenvals.R
   pkg/vegan/R/wcmdscale.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/wcmdscale.Rd
Log:
handle neg eigenvalues in summary statistics of wcmdscale and capscale

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2010-10-14 12:36:07 UTC (rev 1332)
+++ pkg/vegan/DESCRIPTION	2010-10-15 17:27:31 UTC (rev 1333)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.18-13
-Date: September 26, 2010
+Version: 1.18-14
+Date: October 15, 2010
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, 
    Helene Wagner  

Modified: pkg/vegan/R/eigenvals.R
===================================================================
--- pkg/vegan/R/eigenvals.R	2010-10-14 12:36:07 UTC (rev 1332)
+++ pkg/vegan/R/eigenvals.R	2010-10-15 17:27:31 UTC (rev 1333)
@@ -75,10 +75,12 @@
 `summary.eigenvals` <-
     function(object, ...)
 {
-    vars <- object/sum(object)
+    ## abs(object) is to handle neg eigenvalues of wcmdscale and
+    ## capscale
+    vars <- object/sum(abs(object))
     importance <- rbind(`Eigenvalue` = object,
                         `Proportion Explained` = round(vars, 5),
-                        `Cumulative Proportion`= round(cumsum(vars), 5))
+                        `Cumulative Proportion`= round(cumsum(abs(vars)), 5))
     out <- list(importance = importance)
     class(out) <- c("summary.eigenvals", "summary.prcomp")
     out

Modified: pkg/vegan/R/wcmdscale.R
===================================================================
--- pkg/vegan/R/wcmdscale.R	2010-10-14 12:36:07 UTC (rev 1332)
+++ pkg/vegan/R/wcmdscale.R	2010-10-15 17:27:31 UTC (rev 1333)
@@ -41,9 +41,15 @@
     }
     points <- points[, 1:k, drop=FALSE]
     points[!is.finite(points)] <- NA
+    ## Goodness of fit
+    ev <- e$values[1:k]
+    ev <- ev[ev > 0]
+    ## GOF for real and all axes
+    GOF <- c(sum(ev)/sum(e$values[e$values > 0]),
+             sum(ev)/sum(abs(e$values)))
     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 = GOF, weights = w,
                     negaxes = negaxes)
         class(out) <- "wcmdscale"
     }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-10-14 12:36:07 UTC (rev 1332)
+++ pkg/vegan/inst/ChangeLog	2010-10-15 17:27:31 UTC (rev 1333)
@@ -2,8 +2,21 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.18-13 (opened September 26, 2010)
+Versin 1.18-14 (opened October 15, 2010)
 
+	* wcmdscale: give two goodness of fit statistics for 'k' axes: one
+	is for the real part and based on the sum of positive eigenvalues,
+	and second is for all axes and based for the sum of absolute
+	values of all eigenvalues.
+
+	* summary.eigenvals: handle now possible negative eigenvalues from
+	capscale() or wcmdscale(): cumulative sum and proportions are now
+	based on the sum of absolute values of eigenvalues, and all real
+	eigenvalues explain less than 100% if there are negative
+	eigenvalues.
+
+Version 1.18-13 (closed October 15, 2010)
+
 	* anova.cca(..., by = "axis"): now really uses marginal tests for
 	every axis. Significance of axis k with LC scores lc is from model
 	update(object, . ~ lc[,k] + Condition(lc[,-k])). That is, That is,

Modified: pkg/vegan/man/wcmdscale.Rd
===================================================================
--- pkg/vegan/man/wcmdscale.Rd	2010-10-14 12:36:07 UTC (rev 1332)
+++ pkg/vegan/man/wcmdscale.Rd	2010-10-15 17:27:31 UTC (rev 1333)
@@ -35,23 +35,30 @@
   influence on the result than those with low weights. Setting equal
   weights \code{w = 1} will give ordinary multidimensional scaling.
 }
-\value{
-  If \code{eig = FALSE} and \code{x.ret = FALSE} (default), a matrix
-  with \code{k} columns whose rows give the coordinates of the points
-  chosen to represent the dissimilarities.
 
-  Otherwise, an object of class \code{wcmdscale} list containing the
-  following components. 
+\value{ If \code{eig = FALSE} and \code{x.ret = FALSE} (default), a
+  matrix with \code{k} columns whose rows give the coordinates of the
+  points chosen to represent the dissimilarities.
+  Otherwise, an object of class \code{wcmdscale} containing the
+  following components.
   \item{points}{a matrix with \code{k} columns whose rows give the
-    coordinates of the points chosen to represent the dissimilarities.}
-  \item{eig}{the \eqn{n-1} eigenvalues computed during the scaling process if
-    \code{eig} is true.}
-  \item{x}{the doubly centred and weighted distance matrix if \code{x.ret} is true.}
+    coordinates of the points chosen to represent the
+    dissimilarities.}
+  \item{eig}{the \eqn{n-1} eigenvalues computed during the scaling
+    process if \code{eig} is true.}
+  \item{x}{the doubly centred and weighted distance matrix if
+  \code{x.ret} is true.}
+  \item{GOF}{Goodness of fit statistics for \code{k} axes. The first
+    value is for all real axes, and the second value for all axes,
+    including absolute values of negative eigenvalues.}
   \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.}
+  \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)  
   Some distance properties of latent root and vector 



More information about the Vegan-commits mailing list