[Vegan-commits] r332 - in branches/1.11-0: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 25 14:13:50 CEST 2008


Author: gsimpson
Date: 2008-04-25 14:13:50 +0200 (Fri, 25 Apr 2008)
New Revision: 332

Modified:
   branches/1.11-0/DESCRIPTION
   branches/1.11-0/R/betadisper.R
   branches/1.11-0/inst/ChangeLog
   branches/1.11-0/man/betadisper.Rd
Log:
merge r330 and r331 from trunk to 1.11-0 branch, up version number to 1.11-5.

Modified: branches/1.11-0/DESCRIPTION
===================================================================
--- branches/1.11-0/DESCRIPTION	2008-04-25 12:01:33 UTC (rev 331)
+++ branches/1.11-0/DESCRIPTION	2008-04-25 12:13:50 UTC (rev 332)
@@ -1,6 +1,6 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.11-4
+Version: 1.11-5
 Date: April 20, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
   M. Henry H. Stevens  

Modified: branches/1.11-0/R/betadisper.R
===================================================================
--- branches/1.11-0/R/betadisper.R	2008-04-25 12:01:33 UTC (rev 331)
+++ branches/1.11-0/R/betadisper.R	2008-04-25 12:13:50 UTC (rev 332)
@@ -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: branches/1.11-0/inst/ChangeLog
===================================================================
--- branches/1.11-0/inst/ChangeLog	2008-04-25 12:01:33 UTC (rev 331)
+++ branches/1.11-0/inst/ChangeLog	2008-04-25 12:13:50 UTC (rev 332)
@@ -2,8 +2,18 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.11-4 (Opened April 10, 2008)
+Version 1.11-5 (opened April 25, 2008)
 
+	* 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.
+	Merged revisions r330 and r331 from development tree.
+
+Version 1.11-4 (April 10, 2008)
+
 	* adonis: merged Rev 312 (not dropping unused factor levels), Rev
 	315 (wrong df in deficit rank models), Rev 320 (wrong statistics
 	in permutations: a critical bug). 

Modified: branches/1.11-0/man/betadisper.Rd
===================================================================
--- branches/1.11-0/man/betadisper.Rd	2008-04-25 12:01:33 UTC (rev 331)
+++ branches/1.11-0/man/betadisper.Rd	2008-04-25 12:13:50 UTC (rev 332)
@@ -79,6 +79,22 @@
   negative Eigenvalues are produced, we must correct for these imaginary
   distances.
 
+  The distance to its centroid of a point is \deqn{z_{ij}^c =
+  \sqrt{\Delta^2(u_{ij}^+, c_i^+) - \Delta^2(u_{ij}^-, c_i^-)},}{z[ij]^c
+  = sqrt(Delta^2(u[ij]^+, c[i]^+) - Delta^2(u[ij]^-, c[i]^-)),} where
+  \eqn{\Delta^2}{Delta^2} is the squared Euclidean distance between
+  \eqn{u_{ij}}{u[ij]}, the principal coordinate for the \eqn{j^{th}}{jth}
+  point in the \eqn{i^{th}}{ith} group, and \eqn{c_i}{c[i]}, the
+  coordinate of the centroid for the \eqn{i^{th}}{ith} group. The
+  super-scripted \eqn{+} and \eqn{-} indicate the real and imaginary
+  parts respectively. This is equation (3) in Anderson (2006). If the
+  imaginary part is greater in magnitude than the real part, then we
+  would be taking the square root of a negative value, resulting in
+  NaN. From \pkg{vegan} 1.12-12 \code{betadisper} takes the absolute
+  value of the real distance minus the imaginary distance, before
+  computing 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