[Vegan-commits] r330 - in pkg: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Apr 25 11:18:09 CEST 2008
Author: gsimpson
Date: 2008-04-25 11:18:09 +0200 (Fri, 25 Apr 2008)
New Revision: 330
Modified:
pkg/R/betadisper.R
pkg/inst/ChangeLog
pkg/man/betadisper.Rd
Log:
Fix problem with negative distances to a point's centroid
Modified: pkg/R/betadisper.R
===================================================================
--- pkg/R/betadisper.R 2008-04-23 13:26:00 UTC (rev 329)
+++ pkg/R/betadisper.R 2008-04-25 09:18:09 UTC (rev 330)
@@ -33,7 +33,7 @@
dist.neg <- 0
}
## zij are the distances of each point to its group centroid
- zij <- sqrt(dist.pos - dist.neg)
+ zij <- sqrt(abs(dist.pos - dist.neg))
## add in correct labels
colnames(vectors) <- colnames(centroids) <- names(eig) <-
paste("PCoA", 1:n, sep = "")
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2008-04-23 13:26:00 UTC (rev 329)
+++ pkg/inst/ChangeLog 2008-04-25 09:18:09 UTC (rev 330)
@@ -6,8 +6,15 @@
* adonis: added calculation of coefficients both for the species
(when data matrix was given) and for sites (both with the data
- matrices and dissimilarities).
+ matrices and dissimilarities).
+ * betadisper: was not calculating distance to centroid correctly
+ for observations where the imaginary distance to centroid was
+ greater than the real distance (resulting in negative distance)
+ which resulted in NaN when we took the square root. betadisper()
+ now takes the absolute value of the combined distance before taking
+ the square root. This is in-line with Marti Anderson's PERMDISP2.
+
Version 1.12-11 (closed April 23, 2008)
* adonis: permutation tests fixed. The permutation statistics were
Modified: pkg/man/betadisper.Rd
===================================================================
--- pkg/man/betadisper.Rd 2008-04-23 13:26:00 UTC (rev 329)
+++ pkg/man/betadisper.Rd 2008-04-25 09:18:09 UTC (rev 330)
@@ -92,6 +92,15 @@
negative Eigenvalues are produced, we must correct for these imaginary
distances.
+ The distance to its centroid of a point is \eqn{z_{ij}^c =
+ \sqrt{\Delta^2(u_{ij}^+,c_i^+) - \Delta^2(u_{ij}^-,c_i^-)}}, i.e. the
+ real distance minus the imaginary distance. If the imaginary part is
+ greater in magnitude than the real part, then we would take the square
+ root of a negative value, resulting in NaN. From vegan 1.12-12
+ \code{betadisper} takes the absolute value of the real distance minus
+ the imaginary distance, and then takes the square root. This is
+ in line with the behaviour of Marti Anderson's PERMDISP2 programme.
+
To test if one or more groups is more variable than the others, ANOVA
of the distances to group centroids can be performed and parametric
theory used to interpret the significance of F. An alternative is to
More information about the Vegan-commits
mailing list