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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 14 18:42:13 CET 2009


Author: jarioksa
Date: 2009-12-14 18:42:13 +0100 (Mon, 14 Dec 2009)
New Revision: 1080

Modified:
   pkg/vegan/R/vegdist.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/decostand.Rd
   pkg/vegan/man/vegdist.Rd
Log:
interface to alternative Gower skipping double zeros: closes FR#473

Modified: pkg/vegan/R/vegdist.R
===================================================================
--- pkg/vegan/R/vegdist.R	2009-12-14 11:22:34 UTC (rev 1079)
+++ pkg/vegan/R/vegdist.R	2009-12-14 17:42:13 UTC (rev 1080)
@@ -7,7 +7,7 @@
         method <- "euclidean"
     METHODS <- c("manhattan", "euclidean", "canberra", "bray", 
                  "kulczynski", "gower", "morisita", "horn", "mountford", 
-                 "jaccard", "raup", "binomial", "chao")
+                 "jaccard", "raup", "binomial", "chao", "altGower")
     method <- pmatch(method, METHODS)
     inm <- METHODS[method]
     if (is.na(method)) 
@@ -20,7 +20,7 @@
         warning("results may be meaningless because data have negative entries in method ", inm,"\n")
     if (method == 11 && any(colSums(x) == 0)) 
         warning("data have empty species which influence the results im method ", inm, "\n")
-    if (method == 6) 
+    if (method %in% c(6, 14)) 
         x <- decostand(x, "range", 2, na.rm = TRUE, ...)
     if (binary) 
         x <- decostand(x, "pa")

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-12-14 11:22:34 UTC (rev 1079)
+++ pkg/vegan/inst/ChangeLog	2009-12-14 17:42:13 UTC (rev 1080)
@@ -6,6 +6,12 @@
 
 	* goodness.cca: was not using correct weights. Broken in r992 (Sep
 	6, 2009). 
+
+	* vegdist: added UI for the alternative Gower index ("altGower")
+	that skips double zeros. The C code has been in vegan since Oct 24
+	(r1051), but no R interface. Together with decostand(..., "log")
+	of r1052 this closes Feature Request #473 submitted by Etienne
+	Laliberte in R-Forge.
 	
 Version 1.16-33 (closed December 13, 2009)
 

Modified: pkg/vegan/man/decostand.Rd
===================================================================
--- pkg/vegan/man/decostand.Rd	2009-12-14 11:22:34 UTC (rev 1079)
+++ pkg/vegan/man/decostand.Rd	2009-12-14 17:42:13 UTC (rev 1080)
@@ -95,7 +95,7 @@
   
   Anderson, M.J., Ellingsen, K.E. & McArdle, B.H. (2006) Multivariate
   dispersion as a measure of beta diversity. \emph{Ecology Letters} 
-  \strong{9}, 683-693.
+  \strong{9}, 683--693.
 
   Legendre, P. & Gallagher, E.D. (2001) Ecologically meaningful
   transformations for ordination of species data. \emph{Oecologia}

Modified: pkg/vegan/man/vegdist.Rd
===================================================================
--- pkg/vegan/man/vegdist.Rd	2009-12-14 11:22:34 UTC (rev 1079)
+++ pkg/vegan/man/vegdist.Rd	2009-12-14 17:42:13 UTC (rev 1080)
@@ -26,8 +26,9 @@
   \item{x}{Community data matrix.}
   \item{method}{Dissimilarity index, partial match to  \code{"manhattan"},
     \code{"euclidean"}, \code{"canberra"}, \code{"bray"}, \code{"kulczynski"},
-     \code{"jaccard"}, \code{"gower"}, \code{"morisita"}, \code{"horn"},
-     \code{"mountford"}, \code{"raup"} , \code{"binomial"} or \code{"chao"}.}
+     \code{"jaccard"}, \code{"gower"}, \code{"altGower"}, \code{"morisita"}, 
+     \code{"horn"}, \code{"mountford"}, \code{"raup"} , \code{"binomial"} or 
+     \code{"chao"}.}
   \item{binary}{Perform presence/absence standardization before analysis
     using \code{\link{decostand}}.}
   \item{diag}{Compute diagonals. }
@@ -57,6 +58,10 @@
     \tab where \eqn{M} is the number of columns (excluding missing
     values)
     \cr
+    \code{altGower}
+    \tab like \code{gower}, but \eqn{M} is the number of pairs with at least
+    one non-zero value (excluding double zeros)
+    \cr
     \code{canberra}
     \tab \eqn{d_{jk}=\frac{1}{NZ} \sum_i
       \frac{|x_{ij}-x_{ik}|}{x_{ij}+x_{ik}}}{d[jk] = (1/NZ) sum
@@ -193,20 +198,25 @@
   Zealand.  \emph{Journal of Experimental Marine Biology and Ecology}
   305, 191--221.
 
+  Anderson, M.J., Ellingsen, K.E. & McArdle, B.H. (2006) Multivariate
+  dispersion as a measure of beta diversity. \emph{Ecology Letters} 
+  9, 683--693.
+
   Chao, A., Chazdon, R. L., Colwell, R. K. and Shen, T. (2005). A new
   statistical approach for assessing similarity of species composition
   with incidence and abundance data. \emph{Ecology Letters} 8, 148--159.
- 
-  
+   
   Faith, D. P, Minchin, P. R. and Belbin, L. (1987).
   Compositional dissimilarity as a robust measure of ecological
   distance. \emph{Vegetatio} 69, 57--68.
 
+  Gower, J. C. (1971). A general coefficient of similarity and some
+  of its properties. \emph{Biometrics} 27, 623--637.
+
   Krebs, C. J. (1999). \emph{Ecological Methodology.} Addison Wesley Longman.
 
   Legendre, P, & Legendre, L. (1998) \emph{Numerical Ecology}. 2nd English
   Edition. Elsevier.
-
   
   Mountford, M. D. (1962). An index of similarity and its application to
   classification problems. In: P.W.Murphy (ed.),
@@ -228,7 +238,15 @@
   So these differ by a constant multiplier, and the alternative in
   \code{vegdist} is in range (0,1).  Function \code{\link[cluster]{daisy}}
   (package \pkg{cluster}) provides alternative implementation of Gower
-  index that also can handle mixed data of numeric and class variables.
+  index that also can handle mixed data of numeric and class variables. 
+  There are two versions of Gower distance (\code{"gower"}, 
+  \code{"altGower"}) which differ in scaling: \code{"gower"} divides
+  all distances by the number of observations (rows), but 
+  \code{"altGower"} omits double-zeros and divides by the number of 
+  pairs with at least one above-zero value. Gower (1971) suggested this for
+  presences, but it is often taken as the general feature of the Gower 
+  distances. See Examples for implementing the Anderson et al. (2006)
+  variant of the Gower index.
 
   Most dissimilarity indices in \code{vegdist} are designed for
   community data, and they will give misleading values if there are
@@ -252,5 +270,7 @@
 vare.dist <- vegdist(varespec)
 # Orlóci's Chord distance: range 0 .. sqrt(2)
 vare.dist <- vegdist(decostand(varespec, "norm"), "euclidean")
+# Anderson et al. version of Gower
+vare.dist <- vegdist(decostand(varespec, "log"), "altGower")
 }
 \keyword{ multivariate }



More information about the Vegan-commits mailing list