[Vegan-commits] r337 - in pkg: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 7 10:05:00 CEST 2008


Author: jarioksa
Date: 2008-05-07 10:05:00 +0200 (Wed, 07 May 2008)
New Revision: 337

Modified:
   pkg/DESCRIPTION
   pkg/R/capscale.R
   pkg/R/metaMDSdist.R
   pkg/inst/ChangeLog
   pkg/man/capscale.Rd
   pkg/man/metaMDS.Rd
Log:
capscale can now do unconstrained principal coordinates analysis, and use extended dissimilarities via metaMDSdist

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/DESCRIPTION	2008-05-07 08:05:00 UTC (rev 337)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.12-13
-Date: May 1, 2008
+Version: 1.12-14
+Date: May 7, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
   M. Henry H. Stevens  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>

Modified: pkg/R/capscale.R
===================================================================
--- pkg/R/capscale.R	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/R/capscale.R	2008-05-07 08:05:00 UTC (rev 337)
@@ -1,6 +1,6 @@
 `capscale` <-
     function (formula, data, distance = "euclidean", comm = NULL, 
-              add = FALSE, ...) 
+              add = FALSE, dfun = vegdist, metaMDSdist = FALSE, ...) 
 {
     if (!inherits(formula, "formula")) 
         stop("Needs a model formula")
@@ -15,7 +15,13 @@
     X <- eval(X, environment(formula))
     if (!inherits(X, "dist")) {
         comm <- X
-        X <- vegdist(X, method = distance)
+        dfun <- match.fun(dfun)
+        if (metaMDSdist) {
+            X <- metaMDSdist(comm, distance = distance, zerodist = "ignore",
+                             distfun = dfun, ...)
+        } else {
+            X <- dfun(X, distance)
+        }
     }
     inertia <- attr(X, "method")
     if (is.null(inertia))

Modified: pkg/R/metaMDSdist.R
===================================================================
--- pkg/R/metaMDSdist.R	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/R/metaMDSdist.R	2008-05-07 08:05:00 UTC (rev 337)
@@ -5,7 +5,7 @@
 {
     distname <- deparse(substitute(distfun))
     distfun <- match.fun(distfun)
-    zerodist <- match.arg(zerodist, c("fail", "add"))
+    zerodist <- match.arg(zerodist, c("fail", "add", "ignore"))
     formals(distfun) <- c(formals(distfun), alist(... = ))
     formals(stepacross) <- c(formals(stepacross), alist(... = ))
     if (missing(commname)) 

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/inst/ChangeLog	2008-05-07 08:05:00 UTC (rev 337)
@@ -2,8 +2,22 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.12-13 (opened May 1, 2008)
+Version 1.12-14 (opened May 7, 2008)
 
+	* capscale: accepts now other dissimilarity function than vegdist,
+	and optionally uses metaMDSdist to manipulate dissimilarities
+	similarly as metaMDS. This provides now a one-shot unconstrained
+	principal coordinates analysis ("metaPCoA"), optionally with
+	extended (flexible shortest path) dissimilarities. Incidentally
+	this also implements a "new" possibly unpublished ordination
+	method: extended distance based redundancy analysis.
+
+	* metaMDSdist: argument 'add' gained new alternative "ignore" to
+	do nothing with zero distances. This can only and should be used
+	with metric scaling (cmdscale(), capscale()). 
+	
+Version 1.12-13 (closed May 7, 2008)
+
 	* orditkplot: labels can be edited with double clicking, and
 	shift-mouse allows zooming into smaller are in the plot.
 	

Modified: pkg/man/capscale.Rd
===================================================================
--- pkg/man/capscale.Rd	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/man/capscale.Rd	2008-05-07 08:05:00 UTC (rev 337)
@@ -11,13 +11,15 @@
   is strictly linear and metric. If called with Euclidean distance,
   the results are identical to \code{\link{rda}}, but \code{capscale}
   will be much more inefficient. Function \code{capscale} is a
-  constrained version of metric scaling, a.k.a. principal coordintates
+  constrained version of metric scaling, a.k.a. principal coordinates
   analysis, which is based on the Euclidean distance but can be used,
-  and is more useful, with other dissimilarity measures. 
+  and is more useful, with other dissimilarity measures. The function
+  can also perform unconstrained principal coordinates analysis,
+  optionally using extended dissimilarities.
 }
 \usage{
 capscale(formula, data, distance = "euclidean", comm = NULL,
-         add = FALSE,  ...)
+         add = FALSE,  dfun = vegdist, metaMDSdist = FALSE, ...)
 }
 
 \arguments{
@@ -56,7 +58,16 @@
      basically metric \code{\link{cmdscale}}. They are harmless and
      ignored in \code{capscale}, but you also can avoid warnings with
      this option. }
-  \item{\dots}{Other parameters passed to \code{\link{rda}}. }
+   \item{dfun}{Distance or dissimilarity function used. Any function
+     returning standard \code{"dist"} and taking the index name as the
+     first argument can be used. }
+   \item{metaMDSdist}{Use \code{\link{metaMDSdist}} similarly as in
+     \code{\link{metaMDS}}. This means automatic data transformation and
+     using extended flexible shortest path dissimilarities (function
+     \code{\link{stepacross}}) when there are many dissimilarities based on
+     no shared species.}
+   \item{\dots}{Other parameters passed to \code{\link{rda}} or to
+     \code{\link{metaMDSdist}}.  }
 }
 \details{
   Canonical Analysis of Principal Coordinates (CAP) is simply a
@@ -105,8 +116,13 @@
   efficient. Even with non-Euclidean dissimilarities, the
   rest of the analysis will be metric and linear.
 
-  %The test for all axes is available only for ordinations defined with
-  %\code{formula} interface. 
+  The function can be also used to perform ordinary metric scaling
+  a.k.a. principal coordinates analysis by using a formula with only a
+  constant on the left hand side, or \code{comm ~ 1}. With
+  \code{metaMDSdist = TRUE}, the function can do automatic data
+  standardization and use extended dissimilarities using function
+  \code{\link{stepacross}} similary as in non-metric multidimensional
+  scaling with \code{\link{metaMDS}}. 
   
 }
 \value{
@@ -167,6 +183,8 @@
 vare.cap
 plot(vare.cap)
 anova(vare.cap)
+## Principal coordinates analysis with extended dissimilarities
+capscale(varespec ~ 1, dist="bray", metaMDS = TRUE)
 }
 \keyword{ multivariate }
 

Modified: pkg/man/metaMDS.Rd
===================================================================
--- pkg/man/metaMDS.Rd	2008-05-05 13:46:34 UTC (rev 336)
+++ pkg/man/metaMDS.Rd	2008-05-07 08:05:00 UTC (rev 337)
@@ -87,7 +87,7 @@
  \item{commname}{The name of \code{comm}: should not be given if the
    function is called directly.}
  \item{zerodist}{Handling of zero dissimilarities: either \code{"fail"}
-   or \code{"add"} a small positive value.}
+   or \code{"add"} a small positive value, or \code{"ignore"}.}
  \item{distfun}{Dissimilarity function. Any function returning a
    \code{dist} object and accepting argument \code{method} can be used
    (but some extra arguments may cause name conflicts).}



More information about the Vegan-commits mailing list