[Vegan-commits] r318 - in pkg: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 16 18:31:33 CEST 2008


Author: jarioksa
Date: 2008-04-16 18:31:32 +0200 (Wed, 16 Apr 2008)
New Revision: 318

Modified:
   pkg/R/designdist.R
   pkg/inst/ChangeLog
   pkg/man/designdist.Rd
Log:
designdist known now 2x2 contingency table notation with a,b,c,d

Modified: pkg/R/designdist.R
===================================================================
--- pkg/R/designdist.R	2008-04-16 16:29:47 UTC (rev 317)
+++ pkg/R/designdist.R	2008-04-16 16:31:32 UTC (rev 318)
@@ -1,8 +1,11 @@
 `designdist` <-
-function (x, method = "(A+B-2*J)/(A+B)", terms = c("binary", 
-    "quadratic", "minimum"), name) 
+    function (x, method = "(A+B-2*J)/(A+B)",
+              terms = c("binary", "quadratic", "minimum"),
+              abcd = FALSE, name) 
 {
     terms <- match.arg(terms)
+    if (abcd && terms != "binary")
+        warning("abcd = TRUE and terms are not 'binary':\nresults may be meaingless")
     x <- as.matrix(x)
     N <- nrow(x)
     P <- ncol(x)
@@ -19,6 +22,12 @@
     A <- as.dist(outer(rep(1, N), d))
     B <- as.dist(outer(d, rep(1, N)))
     J <- as.dist(x)
+    if (abcd) {
+        a <- J
+        b <- A - J
+        c <- B - J
+        d <- P - A - B + J
+    }
     dis <- eval(parse(text = method))
     attributes(dis) <- attributes(J)
     attr(dis, "call") <- match.call()

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-04-16 16:29:47 UTC (rev 317)
+++ pkg/inst/ChangeLog	2008-04-16 16:31:32 UTC (rev 318)
@@ -7,6 +7,10 @@
 	* adonis: the fix for the unused factor levels (r312) revealed
 	that adonis did not handle properly aliased variables and
 	pivoting. Results need checking.
+
+	* designdist: gained argument 'abcd = FALSE' to use the 2x2
+	contingency table notation instead of the more tangible default
+	notation. 
 	
 Version 1.12-9 (closed April 13, 2008)
 

Modified: pkg/man/designdist.Rd
===================================================================
--- pkg/man/designdist.Rd	2008-04-16 16:29:47 UTC (rev 317)
+++ pkg/man/designdist.Rd	2008-04-16 16:31:32 UTC (rev 318)
@@ -14,7 +14,8 @@
 }
 \usage{
 designdist(x, method = "(A+B-2*J)/(A+B)",
-           terms = c("binary", "quadratic", "minimum"), name)
+           terms = c("binary", "quadratic", "minimum"), 
+           abcd = FALSE, name)
 }
 
 \arguments{
@@ -32,6 +33,10 @@
       sum(y)}, and \code{"binary"} terms are either of these after transforming
     data into binary form (shared number of species, and number of
     species for each row). }
+  \item{abcd}{Use 2x2 contingency table notation for binary data:
+  \eqn{a} is the number of shared species, \eqn{b} and \eqn{c} are the
+  numbers of species occurring only one of the sites but not in both,
+  and \eqn{d} is the number of species that occur on neither of the sites.}
   \item{name}{The name you want to use for your index. The default is to
     combine the \code{method} equation and \code{terms} argument.}
 }
@@ -66,10 +71,12 @@
   \code{\link{betadiver}} for the purpose.
 
   If you want to implement binary dissimilarities based on the 2x2
-  contingency table notation, then \eqn{a =} \code{J}, \eqn{b =}
-  \code{A-J}, \eqn{c =} \code{B-J}, \eqn{d =} \code{P-A-B+J}, \eqn{b+c
-    =} \code{A+B-2*J}, and \eqn{a+b+c =} \code{A+B-J}.
+  contingency table notation, you can set \code{abcd = TRUE}. In this
+  notation \code{a = J}, \code{b = A-J}, \code{c = B-J}, \code{d =
+  P-A-B+J}. This notation is often used instead fo the more more
+  tangible default notation for reasons that are opaque to me. 
 }
+
 \value{
   \code{designdist} returns an object of class \code{\link{dist}}.
 }



More information about the Vegan-commits mailing list