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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 21 09:11:23 CEST 2010


Author: jarioksa
Date: 2010-05-21 09:11:22 +0200 (Fri, 21 May 2010)
New Revision: 1187

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/mantel.correlog.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/mantel.correlog.Rd
Log:
small fix and extended docs for mantel.correlog (from Pierre Legendre)

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2010-05-05 14:27:40 UTC (rev 1186)
+++ pkg/vegan/DESCRIPTION	2010-05-21 07:11:22 UTC (rev 1187)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.18-4
-Date: April 15, 2010
+Version: 1.18-5
+Date: May 21, 2010
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, 
    Helene Wagner  

Modified: pkg/vegan/R/mantel.correlog.R
===================================================================
--- pkg/vegan/R/mantel.correlog.R	2010-05-05 14:27:40 UTC (rev 1186)
+++ pkg/vegan/R/mantel.correlog.R	2010-05-21 07:11:22 UTC (rev 1187)
@@ -16,7 +16,7 @@
 	D.geo <- as.matrix(D.geo)
     } else {
 	if(is.null(XY)) {
-            stop("You did not provided a geographic distance matrix nor a list of site coordinates")
+            stop("You did not provide a geographic distance matrix nor a list of site coordinates")
         } else {
             D.geo <- as.matrix(dist(XY))
         }
@@ -40,8 +40,8 @@
     } else {
         ## No breakpoints have been provided: equal-width classes
         if(n.class == 0) { 
-            ## Use Sturge's rule to determine the number of classes
-            n.class <- round(1 + log(n.dist, base=2)) 
+            ## Use Sturges rule to determine the number of classes
+            n.class <- ceiling(1 + log(n.dist, base=2))
         }
         ## Compute the breakpoints from n.class
         start.pt <- min(vec.D)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-05-05 14:27:40 UTC (rev 1186)
+++ pkg/vegan/inst/ChangeLog	2010-05-21 07:11:22 UTC (rev 1187)
@@ -2,8 +2,14 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.18-4 (opened April 15, 2010)
+Version 1.18-5 (opened May 21, 2010)
 
+	* mantel.correlog: changes the Sturge's rule to conform with the
+	standard R nclass.Sturges ('ceiling' instead of 'round'. Extends
+	and corrects documentation and messages.
+
+Version 1.18-4 (closed May 21, 2010)
+
 	* envfit: defaults now to 999 permutations. Used to be 0 or no
 	permutations. 
 

Modified: pkg/vegan/man/mantel.correlog.Rd
===================================================================
--- pkg/vegan/man/mantel.correlog.Rd	2010-05-05 14:27:40 UTC (rev 1186)
+++ pkg/vegan/man/mantel.correlog.Rd	2010-05-21 07:11:22 UTC (rev 1187)
@@ -28,7 +28,7 @@
   \item{XY}{ A file of Cartesian geographic coordinates of the
   points. Default: \code{XY=NULL}. }
 
-  \item{n.class}{ Number of classes. If \code{n.class=0}, the Sturge
+  \item{n.class}{ Number of classes. If \code{n.class=0}, the Sturges
   equation will be used unless break points are provided. }
 
   \item{break.pts}{ Vector containing the break points of the distance
@@ -131,32 +131,38 @@
 
   Sokal, R. R. 1986. Spatial data analysis and historical
   processes. 29-43 in: E. Diday et al. [eds.] Data analysis and
-  informatics, IV. North-Holland, Amsterdam.  }
+  informatics, IV. North-Holland, Amsterdam.
+  
+  Sturges, H. A. 1926. The choice of a class interval. Journal of the 
+  American Statistical Association 21: 65–66.  }
 
 \examples{   
-# Mite data from "vegan"
+# Mite data available in "vegan"
 data(mite)        
 data(mite.xy)  
 mite.hel <- decostand(mite, "hellinger")
-mite.hel.D <- dist(mite.hel)
 
-mite.correlog <- mantel.correlog(mite.hel.D, XY=mite.xy, nperm=99)
+# Detrend the species data by regression on the site coordinates
+mite.hel.resid <- resid(lm(as.matrix(mite.hel) ~ ., data=mite.xy))
+
+# Compute the detrended species distance matrix
+mite.hel.D = dist(mite.hel.resid)
+
+# Compute Mantel correlogram with cutoff, Pearson statistic
+mite.correlog = mantel.correlog(mite.hel.D, XY=mite.xy, nperm=99)
 summary(mite.correlog)
 mite.correlog   
+# or: print(mite.correlog)
+# or: print.mantel.correlog(mite.correlog)
 plot(mite.correlog)
 
-mite.correlog2 <- mantel.correlog(mite.hel.D, XY=mite.xy, cutoff=FALSE, 
+# Compute Mantel correlogram without cutoff, Spearman statistic
+mite.correlog2 = mantel.correlog(mite.hel.D, XY=mite.xy, cutoff=FALSE, 
 r.type="spearman", nperm=99)
 summary(mite.correlog2)
 mite.correlog2
 plot(mite.correlog2)
 
-## Mite correlogram after spatially detrending the mite data
-mite.h.det <- resid(lm(as.matrix(mite.hel.D) ~ ., data=mite.xy))
-mite.correlog3 <-  mantel.correlog(mite.h.det, XY=mite.xy, nperm=99)
-mite.correlog3
-plot(mite.correlog3)
-
 }
 
 \keyword{ multivariate }
\ No newline at end of file



More information about the Vegan-commits mailing list