[Vegan-commits] r949 - in branches/1.15: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 25 20:25:02 CEST 2009
Author: jarioksa
Date: 2009-08-25 20:24:54 +0200 (Tue, 25 Aug 2009)
New Revision: 949
Added:
branches/1.15/R/indpower.R
branches/1.15/man/indpower.Rd
Modified:
branches/1.15/inst/ChangeLog
branches/1.15/man/beals.Rd
Log:
copied indpower to branches/1.15
Copied: branches/1.15/R/indpower.R (from rev 948, pkg/vegan/R/indpower.R)
===================================================================
--- branches/1.15/R/indpower.R (rev 0)
+++ branches/1.15/R/indpower.R 2009-08-25 18:24:54 UTC (rev 949)
@@ -0,0 +1,22 @@
+indpower <-
+function(x, type=0)
+{
+ x <- as.matrix(x)
+ x <- ifelse(x > 0, 1, 0)
+ if (NCOL(x) < 2)
+ stop("provide at least 2 columns for 'x'")
+ if (!(type %in% 0:2))
+ stop("'type' must be in c(0, 1, 2)")
+ n <- nrow(x)
+ j <- t(x) %*% x
+ ip1 <- sweep(j, 1, diag(j), "/")
+ ip2 <- 1 - sweep(-sweep(j, 2, diag(j), "-"), 1, n - diag(j), "/")
+ ip <- sqrt(ip1 * ip2)
+ out <- switch(as.character(type),
+ "0" = ip,
+ "1" = ip1,
+ "2" = ip2)
+ colnames(out) <- paste("t", colnames(out), sep=".")
+ rownames(out) <- paste("i", rownames(out), sep=".")
+ out
+}
Modified: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog 2009-08-25 10:32:38 UTC (rev 948)
+++ branches/1.15/inst/ChangeLog 2009-08-25 18:24:54 UTC (rev 949)
@@ -41,6 +41,8 @@
* radlattice copied from pkg/ and merged doc changes r551, 553.
+ * copied indpower (with rev948 for beals.Rd).
+
Version 1.15-3 (released June 17, 2009)
* merged revs 866 to 868: changed the way capscale displays
Modified: branches/1.15/man/beals.Rd
===================================================================
--- branches/1.15/man/beals.Rd 2009-08-25 10:32:38 UTC (rev 948)
+++ branches/1.15/man/beals.Rd 2009-08-25 18:24:54 UTC (rev 949)
@@ -106,7 +106,8 @@
\seealso{\code{\link{decostand}} for proper standardization methods,
\code{\link{specpool}} for an attempt to assess the size of species
- pool. }
+ pool. Function \code{\link{indpower}} assesses the power of each species
+ to estimate the probabilities predicted by \code{beals}. }
\examples{
data(dune)
## Default
Copied: branches/1.15/man/indpower.Rd (from rev 948, pkg/vegan/man/indpower.Rd)
===================================================================
--- branches/1.15/man/indpower.Rd (rev 0)
+++ branches/1.15/man/indpower.Rd 2009-08-25 18:24:54 UTC (rev 949)
@@ -0,0 +1,62 @@
+\encoding{UTF-8}
+\name{indpower}
+\alias{indpower}
+
+\title{Indicator Power of Species}
+
+\description{ Indicator power calculation of Halme et al. (2009)
+ or the congruence between indicator and target species.
+}
+
+\usage{
+indpower(x, type = 0)
+}
+\arguments{
+ \item{x}{Community data frame or matrix. }
+ \item{type}{The type of
+ statistic to be returned. See Details for explanation.}
+}
+\details{
+
+ Halme et al. (2009) described an index of indicator power defined as
+ \eqn{IP_I = \sqrt{a \times b}}{IP_I = sqrt(a*b)}, where \eqn{a = S / O_I} and
+ \eqn{b = 1 - (O_T - S) / (N - O_I)}.
+ \eqn{N} is the number of sites,
+ \eqn{S} is the number of shared occurrences of the indicator (\eqn{I})
+ and the target (\eqn{T}) species. \eqn{O_I} and \eqn{O_T} are number
+ of occurrences of the indicator and target species. The \code{type}
+ argument in the function call enables to choose which statistic to
+ return. \code{type = 0} returns \eqn{IP_I}, \code{type = 1} returns
+ \eqn{a}, \code{type = 2} returns \eqn{b}.
+ Total indicator power (TIP) of an indicator species is the column mean
+ (without its own value, see examples).
+ Halme et al. (2009) explain how to calculate confidence
+ intervals for these statistics.
+}
+\value{
+ A matrix with indicator species as rows and
+ target species as columns (this is indicated by the first letters of the
+ row/column names).
+}
+\references{
+Halme, P., \enc{Mönkkönen}{Monkkonen}, M., Kotiaho, J. S,
+\enc{Ylisirniö}{Ylisirnio}, A-L. 2009. Quantifying the indicator power
+of an indicator species. \emph{Conservation Biology} 23: 1008--1016.
+}
+\author{Peter Solymos}
+
+\seealso{ \code{\link[labdsv]{duleg}} (package \pkg{labdsv}) for the
+indicator species analysis of \enc{Dufrêne}{Dufrene} & Legendre.
+Function \code{\link{beals}} estimates individual cell probabilities
+of species occurrences. }
+
+\examples{
+data(dune)
+## IP values
+ip <- indpower(dune)
+## and TIP values
+diag(ip) <- NA
+rowMeans(ip, na.rm=TRUE)
+}
+\keyword{ multivariate }
+
More information about the Vegan-commits
mailing list