[Vegan-commits] r1897 - in pkg/vegan: R man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 26 17:46:02 CEST 2011


Author: jarioksa
Date: 2011-09-26 17:46:01 +0200 (Mon, 26 Sep 2011)
New Revision: 1897

Modified:
   pkg/vegan/R/clamtest.R
   pkg/vegan/man/clamtest.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
edit clamtest

Modified: pkg/vegan/R/clamtest.R
===================================================================
--- pkg/vegan/R/clamtest.R	2011-09-26 15:44:56 UTC (rev 1896)
+++ pkg/vegan/R/clamtest.R	2011-09-26 15:46:01 UTC (rev 1897)
@@ -2,7 +2,7 @@
 ## Ecology, 92, 1332--1343
 clamtest <- 
 function(comm, groups, coverage.limit = 10,
-specialization = 0.667, npoints = 20, alpha = 0.05/npoints) 
+specialization = 2/3, npoints = 20, alpha = 0.05/20) 
 {
     ## inital checks
     comm <- as.matrix(comm)

Modified: pkg/vegan/man/clamtest.Rd
===================================================================
--- pkg/vegan/man/clamtest.Rd	2011-09-26 15:44:56 UTC (rev 1896)
+++ pkg/vegan/man/clamtest.Rd	2011-09-26 15:46:01 UTC (rev 1897)
@@ -1,23 +1,22 @@
 \name{clamtest}
 \alias{clamtest}
 \alias{summary.clamtest}
-\alias{print.summary.clamtest}
 \alias{plot.clamtest}
+
 \title{
 Multinomial Species Classification Method (CLAM)
 }
+
 \description{
 The CLAM statistical approach for classifying generalists and
 specialists in two distinct habitats is described in Chazdon et al. (2011).
 }
 \usage{
-clamtest(comm, groups, coverage.limit = 10, specialization = 0.667, 
-npoints = 20, alpha = 0.05/npoints)
+clamtest(comm, groups, coverage.limit = 10, specialization = 2/3, 
+   npoints = 20, alpha = 0.05/20)
 \method{summary}{clamtest}(object, ...)
-\method{print}{summary.clamtest}(x, digits = max(3, getOption("digits") - 3), ...)
-\method{plot}{clamtest}(x, xlab, ylab, main, 
-pch = 21:24, col.points = 1:4, col.lines = 2:4, 
-lty = 1:3, position = "bottomright", ...)
+\method{plot}{clamtest}(x, xlab, ylab, main,  pch = 21:24, col.points = 1:4, 
+   col.lines = 2:4, lty = 1:3, position = "bottomright", ...)
 }
 \arguments{
   \item{comm}{
@@ -29,33 +28,28 @@
 }
   \item{coverage.limit}{
 Integer, below this limit the sample coverage based correction
-is applied to rare species. Sample coverage is claculated separately 
+is applied to rare species. Sample coverage is calculated separately 
 for the two habitats. Sample relative abundances are used for species 
-with higher than or equal to 10 total counts per habitat.
+with higher than or equal to \code{coverage.limit} total counts per habitat.
 }
   \item{specialization}{
 Numeric, specialization threshold value between 0 and 1.
-The value of 0.667 represents 'supermajority' rule,
-while a value of 0.5 represents a 'simple majority' rule
+The value of \eqn{2/3} represents \sQuote{supermajority} rule,
+while a value of \eqn{1/2} represents a \sQuote{simple majority} rule
 to assign shared species as habitat specialists.
 }
   \item{npoints}{
 Integer, number of points used to determine the boundary lines
 in the plots.
 }
-  \item{alpha}{
-Numeric, significance level for individual tests.
-The default value sets the overall (experiment-wise) 
-significance level to 0.05 by controlling for
-the number of points (\code{npoints}) used to construct
-boundary lines.
-}
+\item{alpha}{ Numeric, nominal significance level for individual
+  tests.  The default value reduces the conventional limit of
+  \eqn{0.05} to account for overdispersion and multiple testing for
+  several species simultaneously. However, the is no firm reason for
+  exactly this limit.  }
   \item{x, object}{
 Fitted model object of class \code{"clamtest"}.
 }
-  \item{digits}{
-Number of decimal digits in the output.
-}
   \item{xlab, ylab}{
 Labels for the plot axes.
 }
@@ -76,31 +70,36 @@
 Additional arguments passed to methods.
 }
 }
-\details{
-The method uses a multinomial model based on estimated species
-relative abundance in two habitats (A, B), it minimizes bias due to differences in sampling
-intensities between two habitat types as well as bias due to insufficient sampling within each
-habitat. The method permits a robust statistical classification of habitat specialists and
-generalists, without excluding rare species a priori (Chazdon et al. 2011).
-Based on a user-defined \code{specialization}
-threshold, the model classifies species into one of four groups: (1) generalist; (2) habitat A
-specialist; (3) habitat B specialist; and (4) too rare to classify with confidence.
+
+\details{ The method uses a multinomial model based on estimated
+  species relative abundance in two habitats (A, B). It minimizes bias
+  due to differences in sampling intensities between two habitat types
+  as well as bias due to insufficient sampling within each
+  habitat. The method permits a robust statistical classification of
+  habitat specialists and generalists, without excluding rare species
+  \emph{a priori} (Chazdon et al. 2011).  Based on a user-defined
+  \code{specialization} threshold, the model classifies species into
+  one of four groups: (1) generalists; (2) habitat A specialists; (3)
+  habitat B specialists; and (4) too rare to classify with confidence.
+  } 
+
+\value{ A data frame (with class attribute \code{"clamtest"}),
+  with columns: 
+  \itemize{ 
+    \item{\code{Species}:}{ species name (column names from \code{comm}),} 
+    \item{\code{Total_*A*}:}{ total count in habitat A,} 
+    \item{\code{Total_*B*}:}{ total count in habitat B,} 
+    \item{\code{Classes}:}{ species classification, a factor with
+       levels \code{Generalist}, \code{Specialist_*A*},
+       \code{Specialist_*B*}, and \code{Too_rare}.}  
 }
-\value{
-A data frame (with class attribute \code{"clamtest"}), with columns:
-\itemize{
-  \item{\code{Species}:}{ species names (column names from \code{comm}),}
-  \item{\code{Total_*A*}:}{ total count in habitat A,}
-  \item{\code{Total_*B*}:}{ total count in habitat B,}
-  \item{\code{Classes}:}{ species classification, a factor with levels
-    \code{Generalist}, \code{Specialist_*A*}, \code{Specialist_*B*}, and \code{Too_rare}.}
-}
-\code{*A*} and \code{*B*} are placeholders for habitat names/labels found in the data.
+  \code{*A*} and \code{*B*} are placeholders for habitat names/labels found in the
+  data.
 
 The \code{summary} method returns descriptive statistics of the results.
 The \code{plot} method returns values invisibly and produces a bivariate
 scatterplot of species total abundances in the two habitats. Symbols and
-boundary lines are shown to separate species groups.
+boundary lines are shown for species groups.
 }
 \references{
 Chazdon, R. L., Chao, A., Colwell, R. K., Lin, S.-Y., Norden, N., 
@@ -117,13 +116,32 @@
 minor inconsistencies were found, especially for finding the
 threshold for 'too rare' species.
 These inconsistencies are probably due to numerical differences between the
-two implementation. The current R implementation uses 
-root finding for iso-lines instead of itarative search.
+two implementation. The current \R implementation uses 
+root finding for iso-lines instead of iterative search.
+
+The original method (Chazdon et al. 2011) has two major problems:
+\enumerate{
+  
+  \item It assumes that the error distribution is multinomial. This is
+    a justified choice if individuals are freely distributed, and
+    there is no over-dispersion or clustering of individuals. In most
+    ecological data, the variance is much higher than multinomial
+    assumption, and therefore test statistic are too optimistic.
+
+  \item The original authors suggest that multiple testing adjustment
+    for multiple testing should be based on the number of points
+    (\code{npoints}) used to draw the critical lines on the plot,
+    whereas the adjustment should be based on the number tests (i.e,
+    tested species). The function uses the same numerical values as
+    the original paper, but there is no automatic connection between
+    \code{npoints} and \code{alpha} arguments, but you must work out
+    the adjustment yourself.
 }
+}
 \examples{
 data(mite)
 data(mite.env)
-x <- clamtest(mite, mite.env$Shrub=="None", alpha=0.005, specialization = 0.667)
+x <- clamtest(mite, mite.env$Shrub=="None", alpha=0.005)
 summary(x)
 head(x)
 plot(x)

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-09-26 15:44:56 UTC (rev 1896)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-09-26 15:46:01 UTC (rev 1897)
@@ -161,7 +161,7 @@
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x1026110e8>
+<environment: 0x102611008>
 Total model degrees of freedom 3 
 
 GCV score: 0.0427924
@@ -1790,18 +1790,18 @@
 > 
 > ### Name: clamtest
 > ### Title: Multinomial Species Classification Method (CLAM)
-> ### Aliases: clamtest summary.clamtest print.summary.clamtest plot.clamtest
+> ### Aliases: clamtest summary.clamtest plot.clamtest
 > ### Keywords: htest
 > 
 > ### ** Examples
 > 
 > data(mite)
 > data(mite.env)
-> x <- clamtest(mite, mite.env$Shrub=="None", alpha=0.005, specialization = 0.667)
+> x <- clamtest(mite, mite.env$Shrub=="None", alpha=0.005)
 > summary(x)
 Two Groups Species Classification Method (CLAM)
 
-Specialization threshold = 0.667
+Specialization threshold = 0.6666667
 Alpha level = 0.005
 
 Estimated sample coverage:
@@ -4272,7 +4272,7 @@
 > flush(stderr()); flush(stdout())
 > 
 > ### Name: oecosimu
-> ### Title: Null Models for Biological Communities
+> ### Title: Evaluate Statistics with Null Models of Biological Communities
 > ### Aliases: oecosimu commsimulator as.ts.oecosimu as.mcmc.oecosimu
 > ###   density.oecosimu densityplot.oecosimu
 > ### Keywords: multivariate datagen
@@ -5004,7 +5004,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1074d1a40>
+<environment: 0x107232ca0>
 
 Estimated degrees of freedom:
 6.4351  total = 7.435071 
@@ -5020,7 +5020,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10787d120>
+<environment: 0x10785fc00>
 
 Estimated degrees of freedom:
 6.1039  total = 7.103853 
@@ -5176,7 +5176,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x106cedd18>
+<environment: 0x104f32f78>
 
 Estimated degrees of freedom:
 8.9275  total = 9.927492 
@@ -5189,7 +5189,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x104bac468>
+<environment: 0x1073aa3c0>
 
 Estimated degrees of freedom:
 7.7529  total = 8.75294 
@@ -5202,7 +5202,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x107be6240>
+<environment: 0x107b7aca8>
 
 Estimated degrees of freedom:
 8.8962  total = 9.89616 
@@ -7464,7 +7464,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10680abc0>
+<environment: 0x108031840>
 
 Estimated degrees of freedom:
 2  total = 3 
@@ -7940,7 +7940,7 @@
 > ### * <FOOTER>
 > ###
 > cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  110.481 1.351 113.149 0 0 
+Time elapsed:  112.907 1.395 116.971 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list