[Vegan-commits] r770 - in branches/1.15: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 30 18:42:03 CEST 2009


Author: jarioksa
Date: 2009-03-30 18:42:02 +0200 (Mon, 30 Mar 2009)
New Revision: 770

Added:
   branches/1.15/R/dispindmorisita.R
   branches/1.15/man/dispindmorisita.Rd
Modified:
   branches/1.15/inst/ChangeLog
Log:
copied dispindmorisita from pkg/ to branches/1.15

Copied: branches/1.15/R/dispindmorisita.R (from rev 769, pkg/vegan/R/dispindmorisita.R)
===================================================================
--- branches/1.15/R/dispindmorisita.R	                        (rev 0)
+++ branches/1.15/R/dispindmorisita.R	2009-03-30 16:42:02 UTC (rev 770)
@@ -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: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog	2009-03-30 16:31:26 UTC (rev 769)
+++ branches/1.15/inst/ChangeLog	2009-03-30 16:42:02 UTC (rev 770)
@@ -5,9 +5,10 @@
 
 Version 1.15-2 (opened January 14, 2009)
 
-	* copied kendall.global at rev767 from pkg/vegan tree to
-	branches/1.15.
+	* copied dispindmorisita at rev769 from pkg/vegan.
 
+	* copied kendall.global at rev767 from pkg/vegan.
+	
 	* merged r608: plot.radfit gained argument log = "y".
 
 	* merged r538: orditkplot makes TIFF graphics.

Copied: branches/1.15/man/dispindmorisita.Rd (from rev 769, pkg/vegan/man/dispindmorisita.Rd)
===================================================================
--- branches/1.15/man/dispindmorisita.Rd	                        (rev 0)
+++ branches/1.15/man/dispindmorisita.Rd	2009-03-30 16:42:02 UTC (rev 770)
@@ -0,0 +1,103 @@
+\encoding{UTF-8}
+\name{dispindmorisita}
+\alias{dispindmorisita}
+\title{Morisita index of intraspecific aggregation}
+\description{
+Calculates 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 used to calculate 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 \eqn{xi} is the count of individuals in sample \eqn{i}, and \eqn{n} is the
+number of samples (\eqn{i = 1, 2, \ldots, n}). \eqn{Imor} has values from 0 to
+\eqn{n}. In uniform (hyperdispersed) patterns its value falls between 0 and
+1, in clumped patterns it falls between 1 and \eqn{n}. For increasing sample
+sizes (i.e. joining neighbouring quadrats), \eqn{Imor} goes to \eqn{n} as the
+quadrat size approaches clump size. For random patterns, \eqn{Imor = 1} and
+counts in the samples follow Poisson frequency distribution.
+
+The deviation from random expectation can be tested using critical
+values of the Chi-squared distribution with \eqn{n-1} degrees of
+freedom. Confidence interval around 1 can be calculated by the clumped
+\eqn{Mclu} and uniform \eqn{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 \eqn{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 scaling of Morisita index from [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 equations apply
+to calculate the standardized index \eqn{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 clumpedness 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
+results in a hiatus in the [0, 0.5] interval of the standardized
+index. The root 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{
+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 }



More information about the Vegan-commits mailing list