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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 5 19:59:23 CEST 2008


Author: psolymos
Date: 2008-10-05 19:59:22 +0200 (Sun, 05 Oct 2008)
New Revision: 520

Added:
   pkg/R/dispindmorisita.R
   pkg/man/dispindmorisita.Rd
Modified:
   pkg/DESCRIPTION
   pkg/inst/ChangeLog
   pkg/man/adipart.Rd
   pkg/man/permatfull.Rd
   pkg/man/tsallis.Rd
Log:
dispindmorisita function added, plus e-mail changed


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-10-05 17:56:58 UTC (rev 519)
+++ pkg/DESCRIPTION	2008-10-05 17:59:22 UTC (rev 520)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
 Version: 1.16-1
-Date: September 30, 2008
+Date: October 5, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
    Peter Solymos, M. Henry H. Stevens, Helene Wagner  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>

Added: pkg/R/dispindmorisita.R
===================================================================
--- pkg/R/dispindmorisita.R	                        (rev 0)
+++ pkg/R/dispindmorisita.R	2008-10-05 17:59:22 UTC (rev 520)
@@ -0,0 +1,31 @@
+`dispindmorisita` <-
+function(x, unique.rm=FALSE, crit=0.05)
+{
+    x <- as.matrix(x)
+    n <- nrow(x)
+    p <- ncol(x)
+    Imor <- numeric(p)
+    Imor <- apply(x, 2, function(y) n * ((sum(y^2) - sum(y)) / (sum(y)^2 - sum(y))))
+    Smor <- Imor
+    chicr <- qchisq(c(0+crit/2, 1-crit/2), n-1)
+    Muni <- apply(x, 2, function(y) (chicr[1] - n + sum(y)) / (sum(y) - 1))
+    Mclu <- apply(x, 2, function(y) (chicr[2] - n + sum(y)) / (sum(y) - 1))
+    for (i in 1:p) {
+        if (apply(x, 2, sum)[i] > 1) {
+            if (Imor[i] >= Mclu[i] && Mclu[i] > 1)
+                Smor[i] <- 0.5 + 0.5 * ((Imor[i] - Mclu[i]) / (n - Mclu[i]))
+            if (Mclu[i] > Imor[i] && Imor[i] >=1)
+                Smor[i] <- 0.5 * ((Imor[i] - 1) / (Mclu[i] - 1))
+            if (1 > Imor[i] && Imor[i] > Muni[i])
+                Smor[i] <- -0.5 * ((Imor[i] - 1) / (Muni[i] - 1))
+            if (1 > Muni[i] && Muni[i] > Imor[i])
+                Smor[i] <- -0.5 + 0.5 * ((Imor[i] - Muni[i]) / Muni[i])
+        }
+    }
+    out <- data.frame(imor=Imor,mclu=Mclu,muni=Muni,imst=Smor)
+    usp <- which(apply(x > 0, 2, sum) == 1)
+    if (unique.rm && length(usp) != 0)
+        out <- out[-usp,]
+    return(out)
+}
+

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-10-05 17:56:58 UTC (rev 519)
+++ pkg/inst/ChangeLog	2008-10-05 17:59:22 UTC (rev 520)
@@ -4,6 +4,10 @@
 
 Version 1.16-1 (opened September 30, 2008)
 
+    * dispindmorisita: function to calculate Morisita's index of
+    dispersion, and its standardized version. Uses the correct
+    way of standardizing, see Note section in help.
+
 	* radfit: Should work with empty sites (no species) or when the
 	number of species is less or equal the number of parameters
 	estimated (like may happen in sweeping analysis of data frames or

Modified: pkg/man/adipart.Rd
===================================================================
--- pkg/man/adipart.Rd	2008-10-05 17:56:58 UTC (rev 519)
+++ pkg/man/adipart.Rd	2008-10-05 17:59:22 UTC (rev 520)
@@ -1,3 +1,4 @@
+\encoding{UTF-8}
 \name{adipart}
 \alias{adipart}
 \alias{plot.adipart}
@@ -93,7 +94,7 @@
 
 Wagner, H. H., Wildi, O. and Ewald, K.C. 2000. Additive partitioning of plant species diversity in an agricultural mosaic landscape. \emph{Landscape Ecology}, 15, 219-227.
 }
-\author{Peter Solymos, \email{Solymos.Peter at aotk.szie.hu}}
+\author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca}}
 \seealso{See \code{\link{permatfull}} and \code{\link{permatswap}} for permutation settings, and \code{\link{tsallis}} for Tsallis entropy.}
 \examples{
 data(mite)

Added: pkg/man/dispindmorisita.Rd
===================================================================
--- pkg/man/dispindmorisita.Rd	                        (rev 0)
+++ pkg/man/dispindmorisita.Rd	2008-10-05 17:59:22 UTC (rev 520)
@@ -0,0 +1,71 @@
+\encoding{UTF-8}
+\name{dispindmorisita}
+\alias{dispindmorisita}
+\title{Morisita index of intraspecific aggregation}
+\description{
+Caltulates the Morisita index of dispersion, standardized index values, and the so called clumpedness and uniform indices.
+}
+\usage{
+dispindmorisita(x, unique.rm = FALSE, crit = 0.05)
+}
+\arguments{
+  \item{x}{community data matrix, with sites (samples) as rows and species as columns.}
+  \item{unique.rm}{logical, if \code{TRUE}, unique species (occurring in only one sample) are removed from the result.}
+  \item{crit}{two-sided p-value to use calculating critical Chi-squared values.}
+}
+\details{
+The Morisita index of dispersion is defined as (Morisita 1959, 1962):
+
+\code{Imor = n * (sum(xi^2) - sum(xi)) / (sum(xi)^2 - sum(xi))}
+
+where $xi$ is the count of individuals in sample $i$, and $n$ is the number of samples ($i$ = 1, 2, \ldots, $n$). $Imor$ has values from 0 to $n$. In uniform (hyperdispersed) patterns its value falls between 0 and 1, in clumped patterns it falls between 1 and $n$. For incresing sample sizes (i.e. joining neighbouring quadrats), $Imor$ goes to $n$ as the quadrat size approaches clump size. For random patterns, $Imor$ = 1 and counts in the samples follow Poisson frequency distribution.
+
+The deviation from this random expectation can be tested based on critical values of the Chi-squared distribution with degrees of freedom $n-1$. Confidence interval around 1 can be calculated by the clumped $Mclu$ and uniform $Muni$ indices (Hairston et al. 1971, Krebs 1999) (Chi2Lower and Chi2Upper refers to e.g. 0.025 and 0.975 quantile values of the Chi-squared distribution with $n-1$ degrees of freedom, respectively, for \code{alpha = 0.05}):
+
+\code{Mclu = (Chi2Upper - n + sum(xi)) / (sum(xi) - 1)}
+
+\code{Muni = (Chi2Lower - n + sum(xi)) / (sum(xi) - 1)}
+
+Smith-Gill (1975) proposed the standardization of the Morisita index to rescale the [0, n] interval into [-1, 1], and setting up -0.5 and 0.5 values as confidence limits around random distribution with rescaled value 0. To rescale the Morisita index, one of the following four apply to calculate the standardized index $Imst$:
+
+(a) \code{Imor >= Mclu > 1}: \code{Imst = 0.5 + 0.5 (Imor - Mclu) / (n - Mclu)},
+
+(b) \code{Mclu > Imor >= 1}: \code{Imst = 0.5 (Imor - 1) / (Mclu - 1)},
+
+(c) \code{1 > Imor > Muni}: \code{Imst = -0.5 (Imor - 1) / (Muni - 1)},
+
+(d) \code{1 > Muni > Imor}: \code{Imst = -0.5 + 0.5 (Imor - Muni) / Muni}.
+}
+\value{
+Returns a data frame with as many rows as the number of columns in the input data, and with four columns. Columns are: \code{imor} unstandardized Morisita index, \code{mclu} the cumpedness index, \code{muni} the uniform index, \code{imst} standardized Morisita index.
+}
+\references{
+Morisita, M. 1959. Measuring of the dispersion of individuals and analysis of the distributional patterns.
+\emph{Mem. Fac. Sci. Kyushu Univ. Ser. E} 2, 215--235.
+
+Morisita, M. 1962. Id-index, a measure of dispersion of individuals.
+\emph{Res. Popul. Ecol.} 4, 1--7.
+
+Smith-Gill, S. J. 1975. Cytophysiological basis of disruptive pigmentary patterns in the leopard frog, \emph{Rana pipiens}. II.
+Wild type and mutant cell specific patterns. \emph{J. Morphol.} 146, 35--54.
+
+Hairston, N. G., Hill, R. and Ritte, U. 1971. The interpretation of aggregation patterns. In: Patil, G. P., Pileou, E. C. and Waters, W. E. eds. \emph{Statistical Ecology 1: Spatial Patterns and Statistical Distributions}. Penn. State Univ. Press, University Park.
+
+Krebs, C. J. 1999. \emph{Ecological Methodology}. 2nd ed. Benjamin Cummings Publishers.
+}
+\author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca}}
+\note{
+A common error found in several papers is that when standardizing as in the case (b), the denominator is given as \code{Muni - 1}. This reult in a hiatus in the [0, 0.5] interval of the standardized index. The roort of this typo is the book of Krebs (1999), see the Errata for the book (Page 217, \url{http://www.zoology.ubc.ca/~krebs/downloads/errors_2nd_printing.pdf}).
+}
+\examples{
+library(vegan)
+data(dune)
+x <- dispindmorisita(dune)
+x
+y <- dispindmorisita(dune, unique.rm = TRUE)
+y
+dim(x) ## with unique species
+dim(y) ## unique species removed
+}
+\keyword{ multivariate }
+\keyword{ spatial }

Modified: pkg/man/permatfull.Rd
===================================================================
--- pkg/man/permatfull.Rd	2008-10-05 17:56:58 UTC (rev 519)
+++ pkg/man/permatfull.Rd	2008-10-05 17:59:22 UTC (rev 520)
@@ -1,3 +1,4 @@
+\encoding{UTF-8}
 \name{permat}
 \alias{permatfull}
 \alias{permatswap}
@@ -96,7 +97,7 @@
 Applied Statistics 30, 91-97.
 }
 
-\author{Peter Solymos, \email{Solymos.Peter at aotk.szie.hu}; Jari Oksanen translated the original 'swapcount' algorithm for count data into C}
+\author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca}; Jari Oksanen translated the original 'swapcount' algorithm for count data into C}
 
 \seealso{
 \code{\link{commsimulator}}, \code{\link{r2dtable}}, \code{\link{sample}}

Modified: pkg/man/tsallis.Rd
===================================================================
--- pkg/man/tsallis.Rd	2008-10-05 17:56:58 UTC (rev 519)
+++ pkg/man/tsallis.Rd	2008-10-05 17:59:22 UTC (rev 520)
@@ -1,3 +1,4 @@
+\encoding{UTF-8}
 \name{tsallis}
 \alias{tsallis}
 \alias{tsallisaccum}
@@ -55,7 +56,7 @@
 Keylock, CJ (2005). Simpson diversity and the Shannon-Wiener index as special cases of a generalized entropy.
   \emph{Oikos} 109, 203--207.
 }
-\author{Peter Solymos, based on the code of Roeland Kindt and Jari Oksanen written for \code{renyi}}
+\author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca}, based on the code of Roeland Kindt and Jari Oksanen written for \code{renyi}}
 \seealso{
 Plotting methods and accumulation routins are based on functions \code{\link{renyi}} and \code{\link{renyiaccum}}. An object of class 'tsallisaccum' can be used with function \code{\link{rgl.renyiaccum}} as well. See also settings for \code{\link{persp}}.
 }



More information about the Vegan-commits mailing list