[Vegan-commits] r786 - in pkg/vegan: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Apr 4 11:15:45 CEST 2009
Author: gsimpson
Date: 2009-04-04 11:15:43 +0200 (Sat, 04 Apr 2009)
New Revision: 786
Modified:
pkg/vegan/R/betadisper.R
pkg/vegan/man/betadisper.Rd
Log:
remove tol argument in betadisper; no automatic zapping of zero eigenvalues
Modified: pkg/vegan/R/betadisper.R
===================================================================
--- pkg/vegan/R/betadisper.R 2009-04-03 15:59:11 UTC (rev 785)
+++ pkg/vegan/R/betadisper.R 2009-04-04 09:15:43 UTC (rev 786)
@@ -1,6 +1,8 @@
`betadisper` <-
- function(d, group, type = c("centroid","median"), tol = 1e-07)
+ function(d, group, type = c("centroid","median"))
{
+ ## Tolerance for zero Eigenvalues
+ TOL <- 1e-7
## uses code from stats:::cmdscale by R Core Development Team
if(!inherits(d, "dist"))
stop("distances 'd' must be a 'dist' object")
@@ -19,14 +21,9 @@
e <- eigen(-x/2, symmetric = TRUE)
vectors <- e$vectors
eig <- e$values
- ## check d is Euclidean
- w0 <- eig[n] / eig[1]
- if(w0 > -tol)
- r <- sum(eig > (eig[1] * tol))
- else
- r <- length(eig)
- ## truncate eig if d is Euclidean
- eig <- eig[(rs <- seq_len(r))]
+ ## Remove zero eigenvalues
+ eig <- eig[abs(eig/eig[1]) > TOL]
+ rs <- seq_along(eig)
## scale Eigenvectors
vectors <- vectors[, rs, drop = FALSE] %*% diag(sqrt(abs(eig)))
## store which are the positive eigenvalues
Modified: pkg/vegan/man/betadisper.Rd
===================================================================
--- pkg/vegan/man/betadisper.Rd 2009-04-03 15:59:11 UTC (rev 785)
+++ pkg/vegan/man/betadisper.Rd 2009-04-04 09:15:43 UTC (rev 786)
@@ -25,7 +25,7 @@
Tukey's 'Honest Significant Difference' method.
}
\usage{
-betadisper(d, group, type = c("centroid", "median"), tol = 1e-07)
+betadisper(d, group, type = c("centroid", "median"))
\method{anova}{betadisper}(object, \dots)
@@ -51,7 +51,6 @@
level (i.e.~one group).}
\item{type}{the type of analysis to perform. Only \code{type =
"centroid"} is currently supported.}
- \item{tol}{tolerance for checking if \code{d} is Euclidean.}
\item{display}{character; partial match to access scores for
\code{"sites"} or \code{"species"}.}
\item{object, x}{an object of class \code{"betadisper"}, the result of a
More information about the Vegan-commits
mailing list