[Vegan-commits] r2641 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 31 21:24:59 CET 2013
Author: jarioksa
Date: 2013-10-31 21:24:59 +0100 (Thu, 31 Oct 2013)
New Revision: 2641
Modified:
pkg/vegan/R/renyiaccum.R
pkg/vegan/R/specaccum.R
pkg/vegan/R/tsallisaccum.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/renyi.Rd
pkg/vegan/man/specaccum.Rd
pkg/vegan/man/tsallis.Rd
Log:
spec/renyi/tsallis accum gained 'subset'
Modified: pkg/vegan/R/renyiaccum.R
===================================================================
--- pkg/vegan/R/renyiaccum.R 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/R/renyiaccum.R 2013-10-31 20:24:59 UTC (rev 2641)
@@ -1,6 +1,9 @@
`renyiaccum` <-
-function(x, scales=c(0, 0.5, 1, 2, 4, Inf), permutations = 100, raw = FALSE, ...)
-{
+function(x, scales=c(0, 0.5, 1, 2, 4, Inf), permutations = 100,
+ raw = FALSE, subset, ...)
+{
+ if (!missing(subset))
+ x <- subset(x, subset)
x <- as.matrix(x)
n <- nrow(x)
p <- ncol(x)
Modified: pkg/vegan/R/specaccum.R
===================================================================
--- pkg/vegan/R/specaccum.R 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/R/specaccum.R 2013-10-31 20:24:59 UTC (rev 2641)
@@ -1,11 +1,15 @@
`specaccum` <-
function (comm, method = "exact", permutations = 100, conditioned=TRUE,
- gamma="jack1", w = NULL, ...)
+ gamma="jack1", w = NULL, subset, ...)
{
METHODS <- c("collector", "random", "exact", "rarefaction", "coleman")
method <- match.arg(method, METHODS)
if (!is.null(w) && !(method %in% c("random", "collector")))
stop(gettextf("weights 'w' can be only used with methods 'random' and 'collector'"))
+ if (!missing(subset)) {
+ comm <- subset(comm, subset)
+ w <- subset(w, subset)
+ }
x <- comm
x <- as.matrix(x)
x <- x[, colSums(x) > 0, drop=FALSE]
Modified: pkg/vegan/R/tsallisaccum.R
===================================================================
--- pkg/vegan/R/tsallisaccum.R 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/R/tsallisaccum.R 2013-10-31 20:24:59 UTC (rev 2641)
@@ -1,6 +1,9 @@
tsallisaccum <-
-function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE, ...)
+function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE,
+ subset, ...)
{
+ if (!missing(subset))
+ x <- subset(x, subset)
x <- as.matrix(x)
n <- nrow(x)
p <- ncol(x)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/inst/ChangeLog 2013-10-31 20:24:59 UTC (rev 2641)
@@ -24,6 +24,9 @@
that residual deviance certainly decreases in bigger model
(testing theory requires nesting, but this is commonly violated by
users: here nesting is necessary).
+
+ * specaccum, renyiaccum, tsallisaccum: gained argument to select a
+ 'subset' of sites (looks like my student would need them).
Version 2.1-36 (closed October 14, 2013)
Modified: pkg/vegan/man/renyi.Rd
===================================================================
--- pkg/vegan/man/renyi.Rd 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/man/renyi.Rd 2013-10-31 20:24:59 UTC (rev 2641)
@@ -14,16 +14,17 @@
\code{renyiaccum} finds these statistics with accumulating sites.
}
\usage{
-renyi(x, scales = c(0, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, Inf), hill = FALSE)
+renyi(x, scales = c(0, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, Inf),
+ hill = FALSE)
\method{plot}{renyi}(x, ...)
renyiaccum(x, scales = c(0, 0.5, 1, 2, 4, Inf), permutations = 100,
- raw = FALSE, ...)
-\method{plot}{renyiaccum} (x, what = c("mean", "Qnt 0.025", "Qnt 0.975"), type = "l",
+ raw = FALSE, subset, ...)
+\method{plot}{renyiaccum}(x, what = c("mean", "Qnt 0.025", "Qnt 0.975"), type = "l",
...)
-\method{persp}{renyiaccum} (x, theta = 220, col = heat.colors(100), zlim, ...)
+\method{persp}{renyiaccum}(x, theta = 220, col = heat.colors(100), zlim, ...)
rgl.renyiaccum(x, rgl.height = 0.2, ...)
}
-%- maybe also 'usage' for other objects documented here.
+
\arguments{
\item{x}{Community data matrix or plotting object. }
\item{scales}{Scales of \enc{Rényi}{Renyi} diversity.}
@@ -33,6 +34,8 @@
\item{raw}{if \code{FALSE} then return summary statistics of
permutations, and if \code{TRUE} then returns the individual
permutations.}
+ \item{subset}{logical expression indicating sites (rows) to keep: missing
+ values are taken as \code{FALSE}.}
\item{what}{Items to be plotted.}
\item{type}{Type of plot, where \code{type = "l"} means lines.}
\item{theta}{Angle defining the viewing direction (azimuthal) in
Modified: pkg/vegan/man/specaccum.Rd
===================================================================
--- pkg/vegan/man/specaccum.Rd 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/man/specaccum.Rd 2013-10-31 20:24:59 UTC (rev 2641)
@@ -19,7 +19,7 @@
}
\usage{
specaccum(comm, method = "exact", permutations = 100,
- conditioned =TRUE, gamma = "jack1", w = NULL, ...)
+ conditioned =TRUE, gamma = "jack1", w = NULL, subset, ...)
\method{plot}{specaccum}(x, add = FALSE, random = FALSE, ci = 2,
ci.type = c("bar", "line", "polygon"), col = par("fg"), ci.col = col,
ci.lty = 1, xlab, ylab = x$method, ylim,
@@ -48,6 +48,8 @@
\item{gamma}{Method for estimating the total extrapolated number of species in the
survey area by function \code{\link{specpool}}}
\item{w}{Weights giving the sampling effort.}
+ \item{subset}{logical expression indicating sites (rows) to keep: missing
+ values are taken as \code{FALSE}.}
\item{x}{A \code{specaccum} result object}
\item{add}{Add to an existing graph.}
\item{random}{\dots}
Modified: pkg/vegan/man/tsallis.Rd
===================================================================
--- pkg/vegan/man/tsallis.Rd 2013-10-17 10:54:26 UTC (rev 2640)
+++ pkg/vegan/man/tsallis.Rd 2013-10-31 20:24:59 UTC (rev 2641)
@@ -9,65 +9,112 @@
}
\usage{
tsallis(x, scales = seq(0, 2, 0.2), norm = FALSE, hill = FALSE)
-tsallisaccum(x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE, ...)
+tsallisaccum(x, scales = seq(0, 2, 0.2), permutations = 100,
+ raw = FALSE, subset, ...)
\method{persp}{tsallisaccum}(x, theta = 220, phi = 15, col = heat.colors(100), zlim, ...)
}
-%- maybe also 'usage' for other objects documented here.
+
\arguments{
\item{x}{Community data matrix or plotting object. }
\item{scales}{Scales of Tsallis diversity.}
- \item{norm}{Logical, if \code{TRUE} diversity values are normalized by their maximum (diversity value at equiprobability conditions).}
+
+ \item{norm}{Logical, if \code{TRUE} diversity values are normalized
+ by their maximum (diversity value at equiprobability conditions).}
+
\item{hill}{Calculate Hill numbers.}
- \item{permutations}{Number of random permutations in accumulating sites.}
- \item{raw}{If \code{FALSE} then return summary statistics of permutations, and if TRUE then returns the individual permutations.}
- \item{theta, phi}{angles defining the viewing direction. \code{theta} gives the azimuthal direction and \code{phi} the colatitude.}
- \item{col}{Colours used for surface.}
- \item{zlim}{Limits of vertical axis.}
- \item{\dots}{Other arguments which are passed to \code{tsallis} and to graphical functions.}
+
+ \item{permutations}{Number of random permutations in accumulating
+ sites.}
-}
-\details{
-The Tsallis diversity (also equivalent to Patil and Taillie diversity) is a one-parametric generalised entropy function, defined as:
+ \item{raw}{If \code{FALSE} then return summary statistics of
+ permutations, and if TRUE then returns the individual
+ permutations.}
+ \item{subset}{logical expression indicating sites (rows) to keep:
+ missing values are taken as \code{FALSE}.}
+
+ \item{theta, phi}{angles defining the viewing
+ direction. \code{theta} gives the azimuthal direction and
+ \code{phi} the colatitude.}
+
+ \item{col}{Colours used for surface.} \item{zlim}{Limits of
+ vertical axis.}
+
+ \item{\dots}{Other arguments which are passed to \code{tsallis} and
+ to graphical functions.}
+
+}
+
+\details{ The Tsallis diversity (also equivalent to Patil and Taillie
+diversity) is a one-parametric generalised entropy function, defined
+as:
+
\deqn{H_q = \frac{1}{q-1} (1-\sum_{i=1}^S p_i^q)}{H.q = 1/(q-1)(1-sum(p^q))}
-where \eqn{q} is a scale parameter, \eqn{S} the number of species in the sample (Tsallis 1988, Tothmeresz 1995). This diversity is concave for all \eqn{q>0}, but non-additive (Keylock 2005). For \eqn{q=0} it gives the number of species minus one, as \eqn{q} tends to 1 this gives Shannon diversity, for \eqn{q=2} this gives the Simpson index (see function \code{\link{diversity}}).
+where \eqn{q} is a scale parameter, \eqn{S} the number of species in
+the sample (Tsallis 1988, Tothmeresz 1995). This diversity is concave
+for all \eqn{q>0}, but non-additive (Keylock 2005). For \eqn{q=0} it
+gives the number of species minus one, as \eqn{q} tends to 1 this
+gives Shannon diversity, for \eqn{q=2} this gives the Simpson index
+(see function \code{\link{diversity}}).
-If \code{norm = TRUE}, \code{tsallis} gives values normalized by the maximum:
+If \code{norm = TRUE}, \code{tsallis} gives values normalized by the
+maximum:
\deqn{H_q(max) = \frac{S^{1-q}-1}{1-q}}{H.q(max) = (S^(1-q)-1)/(1-q)}
-where \eqn{S} is the number of species. As \eqn{q} tends to 1, maximum is defined as \eqn{ln(S)}.
+where \eqn{S} is the number of species. As \eqn{q} tends to 1, maximum
+is defined as \eqn{ln(S)}.
-If \code{hill = TRUE}, \code{tsallis} gives Hill numbers (numbers equivalents, see Jost 2007):
+If \code{hill = TRUE}, \code{tsallis} gives Hill numbers (numbers
+equivalents, see Jost 2007):
\deqn{D_q = (1-(q-1) H)^{1/(1-q)}}{D.q = (1-(q-1)*H)^(1/(1-q))}
-Details on plotting methods and accumulating values can be found on the help pages of the functions \code{\link{renyi}} and \code{\link{renyiaccum}}.
+Details on plotting methods and accumulating values can be found on
+the help pages of the functions \code{\link{renyi}} and
+\code{\link{renyiaccum}}.
}
-\value{
-Function \code{tsallis} returns a data frame of selected indices. Function \code{tsallisaccum} with argument \code{raw = FALSE} returns a three-dimensional array, where the first dimension are the accumulated sites, second dimension are the diversity scales, and third dimension are the summary statistics \code{mean}, \code{stdev}, \code{min}, \code{max}, \code{Qnt 0.025} and \code{Qnt 0.975}. With argument \code{raw = TRUE} the statistics on the third dimension are replaced with individual permutation results.
-}
+
+\value{
+Function \code{tsallis} returns a data frame of selected
+indices. Function \code{tsallisaccum} with argument \code{raw = FALSE}
+returns a three-dimensional array, where the first dimension are the
+accumulated sites, second dimension are the diversity scales, and
+third dimension are the summary statistics \code{mean}, \code{stdev},
+\code{min}, \code{max}, \code{Qnt 0.025} and \code{Qnt 0.975}. With
+argument \code{raw = TRUE} the statistics on the third dimension are
+replaced with individual permutation results. }
+
\references{
-Tsallis, C. (1988) Possible generalization of Boltzmann-Gibbs statistics.
- \emph{J. Stat. Phis.} 52, 479--487.
+Tsallis, C. (1988) Possible generalization of Boltzmann-Gibbs
+ statistics. \emph{J. Stat. Phis.} 52, 479--487.
+
Tothmeresz, B. (1995) Comparison of different methods for diversity
ordering. \emph{Journal of Vegetation Science} \bold{6}, 283--290.
-Patil, G. P. and Taillie, C. (1982) Diversity as a concept and its measurement.
- \emph{J. Am. Stat. Ass.} \bold{77}, 548--567.
+Patil, G. P. and Taillie, C. (1982) Diversity as a concept and its
+ measurement. \emph{J. Am. Stat. Ass.} \bold{77}, 548--567.
-Keylock, C. J. (2005) Simpson diversity and the Shannon-Wiener index as special cases of a generalized entropy.
- \emph{Oikos} \bold{109}, 203--207.
+Keylock, C. J. (2005) Simpson diversity and the Shannon-Wiener index
+ as special cases of a generalized entropy. \emph{Oikos} \bold{109},
+ 203--207.
-Jost, L (2007) Partitioning diversity into independent alpha and beta components.
- \emph{Ecology} \bold{88}, 2427--2439.
+Jost, L (2007) Partitioning diversity into independent alpha and beta
+ components. \emph{Ecology} \bold{88}, 2427--2439.
}
-\author{\enc{Péter Sólymos}{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 routines 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}}.
-}
+
+\author{\enc{Péter Sólymos}{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 routines 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}}. }
+
\examples{
data(BCI)
i <- sample(nrow(BCI), 12)
More information about the Vegan-commits
mailing list