Title: | Interpolation and Extrapolation for Species Diversity |
---|---|
Description: | Provides simple functions to compute and plot two types (sample-size- and coverage-based) rarefaction and extrapolation curves for species diversity (Hill numbers) based on individual-based abundance data or sampling-unit- based incidence data; see Chao and others (2014, Ecological Monographs) for pertinent theory and methodologies, and Hsieh, Ma and Chao (2016, Methods in Ecology and Evolution) for an introduction of the R package. |
Authors: | T. C. Hsieh, K. H. Ma and Anne Chao |
Maintainer: | T. C. Hsieh <[email protected]> |
License: | GPL (>= 3) |
Version: | 3.0.1 |
Built: | 2024-08-21 03:15:07 UTC |
Source: | https://github.com/johnsonhsieh/inext |
iNEXT (iNterpolation and EXTrapolation) provides functions to compute and plot two types (sample-size- and coverage-based) interpolation and extrapolation sampling curves of Hill numbers for three most widely used members of Hill numbers (species richness, Shannon diversity and Simpson diversity) for individual-based abundance data or sampling-unit-based incidence data. iNEXT also computes bootstrap confidence intervals around the diversity for rarefied/extrapolated samples, facilitating the comparisons of diversities across multiple assemblages/sites. The estimated asymptote along with a confidence interval for each of the three diversity measures is also provided. An auxiliary function is included to compute/compare diversities across multiple assemblages for a particular user-specified sample size or sample coverage. The sample-size-based rarefaction and extrapolation for species richness were developed by Colwell et al. (2012) and the corresponding coverage-based methodologies were developed by Chao and Jost (2012). Chao et al. (2014) extended the previous work for species richness to Hill numbers. The statistical methods and tools provided in iNEXT efficiently use all data to make more robust and detailed inferences about the sampled assemblages, and also to make objective comparisons of multiple assemblages. A short review of the theoretical background and a brief description of methods are included in an application paper by Hsieh, Ma & Chao (2016). An online version (https://chao.shinyapps.io/iNEXTOnline/) is also available for users without an R background.
T. C. Hsieh
K. H. Ma
Anne Chao
Maintainer: T. C. Hsieh <[email protected]>
Chao, A., Gotelli, N.J., Hsieh, T.C., Sander, E.L., Ma, K.H., Colwell, R.K. & Ellison, A.M. (2014) Rarefaction and extrapolation with Hill numbers: a framework for sampling and estimation in species diversity studies. Ecological Monographs, 84, 45-67.
Chao, A. & Jost, L. (2012) Coverage-based rarefaction and extrapolation: standardizing samples by completeness rather than size. Ecology, 93, 2533-2547.
Colwell, R.K., Chao, A., Gotelli, N.J., Lin, S.-Y., Mao, C.X., Chazdon, R.L. & Longino, J.T. (2012) Models and estimators linking individual-based and sample-based rarefaction, extrapolation and comparison of assemblages. Journal of Plant Ecology, 5, 3-21.
Hsieh, T.C., Ma, K.H. & Chao, A. (2016) iNEXT: An R package for rarefaction and extrapolation of species diversity (Hill numbers). Methods in Ecology and Evolution, 7, 1451-1456.
Ant species incidence frequencies for samples from five elevations/assemblages in northeastern Costa Rica (Longino and Colwell 2011). The number of sampling units (1m x 1m forest floor plot) for the 5 assemblages are respectively 599, 230, 150, 200 and 200. The number of observed species for the 5 assemblages are respectively 227, 241, 122, 56 and 14.
data(ant)
data(ant)
The input format for each site is a list of incidence frequencies. For incidence data, the first entry must be the total number of sampling units, followed by the species incidence frequencies as shown below:
A list of 5 vectors
$ h50m : num [1:228] 599 1 1 1 1 1 1 1 1 1 ...
$ h500m : num [1:242] 230 1 1 1 1 1 1 1 1 1 ...
$ h1070m: num [1:123] 150 1 1 1 1 1 1 1 1 1 ...
$ h1500m: num [1:57] 200 1 1 1 1 1 1 1 1 1 ...
$ h2000m: num [1:15] 200 1 2 2 3 4 8 8 13 15 ...
Longino, J.T. & Colwell, R.K. (2011) Density compensation, species composition, and richness of ants on a neotropical elevational gradient. Ecosphere, 2, art29.
as.abucount
: transform species abundance raw data (a species by sites matrix) to row-sum counts (iNEXT input format) as species abundances.
as.abucount(x)
as.abucount(x)
x |
a |
a vector
of species abundance row-sum counts.
data(ciliates) lapply(ciliates, as.abucount)
data(ciliates) lapply(ciliates, as.abucount)
as.incfreq
: transform incidence raw data (a species by sites detection/non-detection or presence/absence matrix) to incidence frequencies data (iNEXT input format):
the first element is the total number of sampling units, followed by the vector of species frequencies. Here species frequencies represent the row sums of the incidence raw matrix.
as.incfreq(x)
as.incfreq(x)
x |
a |
a vector
of species incidence frequencies, the first element is the total number of sampling units.
data(ciliates) lapply(ciliates, as.incfreq)
data(ciliates) lapply(ciliates, as.incfreq)
This data set includes the abundances of 41 bird species collected in two sites (the North and South sites) at the Barrington Tops National Park, Australia (Chao et al. 2015)
data(bird)
data(bird)
a data.frame with 41 species (rows) and two sites (columns).
Chao, A., Chiu, C.-H., Hsieh, T. C., Davis, T., Nipperess, D., and Faith, D. (2015) Rarefaction and extrapolation of phylogenetic diversity. Methods in Ecology and Evolution, 6, 380-388.
data(bird) ## Not run: out <- iNEXT(bird, datatype="abundance") ggiNEXT(out) ## End(Not run)
data(bird) ## Not run: out <- iNEXT(bird, datatype="abundance") ggiNEXT(out) ## End(Not run)
ChaoRichness
: estimation of species richness based on the methods proposed in Chao (1984, 1987)
ChaoRichness(x, datatype = "abundance", conf = 0.95)
ChaoRichness(x, datatype = "abundance", conf = 0.95)
x |
a |
datatype |
data type of input data: individual-based abundance data ( |
conf |
a positive number |
A data.frame of observed species richness, species richness estimate, s.e. and the associated confidence interval.
Chao, A. (1984) Nonparametric estimation of the number of classes in a population. Scandinavian Journal of Statistics, 11, 265-270.
Chao, A. (1987) Estimating the population size for capture-recapture data with unequal catchability. Biometrics, 43, 783-791.
data(spider) ChaoRichness(spider$Girdled, datatype="abundance")
data(spider) ChaoRichness(spider$Girdled, datatype="abundance")
ChaoShannon
: estimation of Shannon entropy or transformed Shannon diversity based on the method proposed by Chao et al. (2013)
ChaoShannon(x, datatype = "abundance", transform = FALSE, conf = 0.95, B = 200)
ChaoShannon(x, datatype = "abundance", transform = FALSE, conf = 0.95, B = 200)
x |
a |
datatype |
data type of input data: individual-based abundance data ( |
transform |
a |
conf |
a positive number |
B |
an integer specifying the number of bootstrap replications. |
A data.frame of observed Shannon entropy/diversity, estimate of entropy/diversity, s.e. and the associated confidence interval.
Chao, A., Wang, Y.T. & Jost, L. (2013) Entropy and the species accumulation curve: a novel entropy estimator via discovery rates of new species. Methods in Ecology and Evolution, 4, 1091-1100.
data(spider) ChaoShannon(spider$Girdled, datatype="abundance")
data(spider) ChaoShannon(spider$Girdled, datatype="abundance")
ChaoSimpson
: estimation of Gini-Simpson index or the transformed Simpson diversity based on the methods proposed in Good (1953) and Chao et al. (2014)
ChaoSimpson(x, datatype = "abundance", transform = FALSE, conf = 0.95, B = 200)
ChaoSimpson(x, datatype = "abundance", transform = FALSE, conf = 0.95, B = 200)
x |
a |
datatype |
data type of input data: individual-based abundance data ( |
transform |
a |
conf |
a positive number |
B |
an integer specifying the number of bootstrap replications. |
a data.frame of observed Gini-Simpson index/diversity, index/diversity estimator, s.e. and the associated confidence interval.
Chao, A., Gotelli, N.J., Hsieh, T.C., Sander, E.L., Ma, K.H., Colwell, R.K. & Ellison, A.M. (2014) Rarefaction and extrapolation with Hill numbers: a framework for sampling and estimation in species diversity studies. Ecological Monographs, 84, 45-67.
Good, I.J. (1953) The population frequencies of species and the estimation of population parameters. Biometrika, 40, 237-264.
data(spider) ChaoSimpson(spider$Girdled, datatype="abundance")
data(spider) ChaoSimpson(spider$Girdled, datatype="abundance")
A total of 51 soil samples were taken from three areas ( EtoshaPan
, CentralNamibDesert
, SouthernNamibDesert
) of Namibia. In area EtoshaPan
, there were 19 soil samples and the number of observed species was 216. In area CentralNamibDesert
, there were 17 soil samples and the number of observed species was 130. In area SouthernNamibDesert
, there were 15 soil samples and the number of observed species was 150. The total number of species in the three areas was 365. The data include three lists of matrices; each matrix is a species by soil-sample matrix ("1" for a detection, and "0" otherwise).
data("ciliates")
data("ciliates")
A list 3 matrices:
$EtoshaPan is a matrix with 365 species (rows) and 19 soil samples (columns).
$CentralNamibDesert is a matrix with 365 species (rows) and 17 soil samples (columns).
$SouthernNamibDesert is a matrix with 365 species (rows) and 15 soil samples (columns).
Foissner, W., Agatha, S., & Berger, H. (2002) Soil Ciliates (Protozoa, Ciliophora) from Namibia (Southwest Africa), With Emphasis on Two Contrasting Environments, the Etosha Region and the Namib Desert. Denisia, 5, 1-1459.
data(ciliates) ## Not run: out <- iNEXT(ciliates, datatype = "incidence_raw") ggiNEXT(out) ## End(Not run)
data(ciliates) ## Not run: out <- iNEXT(ciliates, datatype = "incidence_raw") ggiNEXT(out) ## End(Not run)
DataInfo
: exhibits basic data information
DataInfo(x, datatype = "abundance")
DataInfo(x, datatype = "abundance")
x |
a vector/matrix/data.frame/list of species abundances or incidence frequencies. |
datatype |
data type of input data: individual-based abundance data ( |
a data.frame of basic data information including sample size, observed species richness, sample coverage estimate, and the first ten abundance/incidence frequency counts.
data(spider) DataInfo(spider, datatype="abundance")
data(spider) DataInfo(spider, datatype="abundance")
estimateD
: computes species diversity (Hill numbers with q = 0, 1 and 2) with a particular user-specified level of sample size or sample coverage.
estimateD( x, q = c(0, 1, 2), datatype = "abundance", base = "size", level = NULL, nboot = 50, conf = 0.95 )
estimateD( x, q = c(0, 1, 2), datatype = "abundance", base = "size", level = NULL, nboot = 50, conf = 0.95 )
x |
a |
q |
a number or vector specifying the diversity order(s) of Hill numbers. |
datatype |
data type of input data: individual-based abundance data ( |
base |
comparison base: sample-size-based ( |
level |
a sequence specifying the particular sample sizes or sample coverages(between 0 and 1).
If |
nboot |
the number of bootstrap times to obtain confidence interval. If confidence interval is not desired, use 0 to skip this time-consuming step; default is 50. |
conf |
a positive number < 1 specifying the level of confidence interval; default is 0.95. |
a data.frame
of species diversity table including the sample size, sample coverage,
method (rarefaction or extrapolation), and diversity estimates with the user-specified diversity orders (q values) and specified sample size or sample coverage.
data(spider) out1 <- estimateD(spider, q = c(0,1,2), datatype = "abundance", base="size") out1 ## Not run: out2 <- estimateD(spider, q = c(0,1,2), datatype = "abundance", base="coverage") out2 data(ant) out <- estimateD(ant, q = c(0,1,2), datatype = "incidence_freq", base="coverage", level=0.985, conf=0.95) out ## End(Not run)
data(spider) out1 <- estimateD(spider, q = c(0,1,2), datatype = "abundance", base="size") out1 ## Not run: out2 <- estimateD(spider, q = c(0,1,2), datatype = "abundance", base="coverage") out2 data(ant) out <- estimateD(ant, q = c(0,1,2), datatype = "incidence_freq", base="coverage", level=0.985, conf=0.95) out ## End(Not run)
Fortify method for classes from the iNEXT package.
## S3 method for class 'iNEXT' fortify(model, data = model$iNextEst, type = 1, ...)
## S3 method for class 'iNEXT' fortify(model, data = model$iNextEst, type = 1, ...)
model |
|
data |
not used by this method |
type |
three types of plots: sample-size-based rarefaction/extrapolation curve ( |
... |
not used by this method |
data(spider) # single-assemblage abundance data out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") ggplot2::fortify(out1, type=1)
data(spider) # single-assemblage abundance data out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") ggplot2::fortify(out1, type=1)
ggiNEXT
: the ggplot
extension for iNEXT
Object to plot sample-size- and coverage-based rarefaction/extrapolation curves along with a bridging sample completeness curve
ggiNEXT( x, type = 1, se = TRUE, facet.var = "None", color.var = "Assemblage", grey = FALSE ) ## S3 method for class 'iNEXT' ggiNEXT( x, type = 1, se = TRUE, facet.var = "None", color.var = "Assemblage", grey = FALSE ) ## Default S3 method: ggiNEXT(x, ...)
ggiNEXT( x, type = 1, se = TRUE, facet.var = "None", color.var = "Assemblage", grey = FALSE ) ## S3 method for class 'iNEXT' ggiNEXT( x, type = 1, se = TRUE, facet.var = "None", color.var = "Assemblage", grey = FALSE ) ## Default S3 method: ggiNEXT(x, ...)
x |
an |
type |
three types of plots: sample-size-based rarefaction/extrapolation curve ( |
se |
a logical variable to display confidence interval around the estimated sampling curve. |
facet.var |
create a separate plot for each value of a specified variable:
no separation |
color.var |
create curves in different colors for values of a specified variable:
all curves are in the same color ( |
grey |
a logical variable to display grey and white ggplot2 theme. |
... |
other arguments passed on to methods. Not currently used. |
a ggplot2 object
# single-assemblage abundance data data(spider) out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") ggiNEXT(x=out1, type=1) ggiNEXT(x=out1, type=2) ggiNEXT(x=out1, type=3) ## Not run: # single-assemblage incidence data with three orders q data(ant) size <- round(seq(10, 500, length.out=20)) y <- iNEXT(ant$h500m, q=c(0,1,2), datatype="incidence_freq", size=size, se=FALSE) ggiNEXT(y, se=FALSE, color.var="Order.q") # multiple-assemblage abundance data with three orders q z <- iNEXT(spider, q=c(0,1,2), datatype="abundance") ggiNEXT(z, facet.var="Assemblage", color.var="Order.q") ggiNEXT(z, facet.var="Both", color.var="Both") ## End(Not run)
# single-assemblage abundance data data(spider) out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") ggiNEXT(x=out1, type=1) ggiNEXT(x=out1, type=2) ggiNEXT(x=out1, type=3) ## Not run: # single-assemblage incidence data with three orders q data(ant) size <- round(seq(10, 500, length.out=20)) y <- iNEXT(ant$h500m, q=c(0,1,2), datatype="incidence_freq", size=size, se=FALSE) ggiNEXT(y, se=FALSE, color.var="Order.q") # multiple-assemblage abundance data with three orders q z <- iNEXT(spider, q=c(0,1,2), datatype="abundance") ggiNEXT(z, facet.var="Assemblage", color.var="Order.q") ggiNEXT(z, facet.var="Both", color.var="Both") ## End(Not run)
iNEXT
: Interpolation and extrapolation of Hill number with order q
iNEXT( x, q = 0, datatype = "abundance", size = NULL, endpoint = NULL, knots = 40, se = TRUE, conf = 0.95, nboot = 50 )
iNEXT( x, q = 0, datatype = "abundance", size = NULL, endpoint = NULL, knots = 40, se = TRUE, conf = 0.95, nboot = 50 )
x |
a |
q |
a number or vector specifying the diversity order(s) of Hill numbers. |
datatype |
data type of input data: individual-based abundance data ( |
size |
an integer vector of sample sizes (number of individuals or sampling units) for which diversity estimates will be computed.
If NULL, then diversity estimates will be computed for those sample sizes determined by the specified/default |
endpoint |
an integer specifying the sample size that is the |
knots |
an integer specifying the number of equally-spaced |
se |
a logical variable to calculate the bootstrap standard error and |
conf |
a positive number < 1 specifying the level of confidence interval; default is 0.95. |
nboot |
an integer specifying the number of replications; default is 50. |
a list of three objects: $DataInfo
for summarizing data information;
$iNextEst
for showing diversity estimates for rarefied and extrapolated samples along with related statistics;
and $AsyEst
for showing asymptotic diversity estimates along with related statistics.
NOTE: From version 3.0.0, $iNextEst
has been expanded to include $size_based
and $coverage_based
to provide two types of confidence intervals.
## Not run: ## example for abundance based data (list of vector) data(spider) out1 <- iNEXT(spider, q=c(0,1,2), datatype="abundance") out1$DataInfo # showing basic data information. out1$AsyEst # showing asymptotic diversity estimates. out1$iNextEst$size_based # showing diversity estimates with rarefied and extrapolated samples; # confidence limits are obtained for fixed sample size. out1$iNextEst$coverage_based # showing diversity estimates with rarefied and extrapolated samples; # confidence limits are obtained for fixed sample coverage. ## End(Not run) ## example for abundance based data (data.frame) data(bird) out2 <- iNEXT(bird, q=0, datatype="abundance") out2 ## Not run: ## example for incidence frequencies based data (list of data.frame) data(ant) t <- round(seq(10, 500, length.out=20)) out3 <- iNEXT(ant$h500m, q=1, datatype="incidence_freq", size=t, se=FALSE) out3$iNextEst ## End(Not run)
## Not run: ## example for abundance based data (list of vector) data(spider) out1 <- iNEXT(spider, q=c(0,1,2), datatype="abundance") out1$DataInfo # showing basic data information. out1$AsyEst # showing asymptotic diversity estimates. out1$iNextEst$size_based # showing diversity estimates with rarefied and extrapolated samples; # confidence limits are obtained for fixed sample size. out1$iNextEst$coverage_based # showing diversity estimates with rarefied and extrapolated samples; # confidence limits are obtained for fixed sample coverage. ## End(Not run) ## example for abundance based data (data.frame) data(bird) out2 <- iNEXT(bird, q=0, datatype="abundance") out2 ## Not run: ## example for incidence frequencies based data (list of data.frame) data(ant) t <- round(seq(10, 500, length.out=20)) out3 <- iNEXT(ant$h500m, q=1, datatype="incidence_freq", size=t, se=FALSE) out3$iNextEst ## End(Not run)
plot.iNEXT
: Plotting method for objects inheriting from class "iNEXT"
## S3 method for class 'iNEXT' plot( x, type = 1, se = TRUE, show.legend = TRUE, show.main = TRUE, col = NULL, ... )
## S3 method for class 'iNEXT' plot( x, type = 1, se = TRUE, show.legend = TRUE, show.main = TRUE, col = NULL, ... )
x |
an |
type |
three types of plots: sample-size-based rarefaction/extrapolation curve ( |
se |
a logical variable to display confidence interval around the estimated sampling curve. |
show.legend |
a logical variable to display legend. |
show.main |
a logical variable to display title. |
col |
a vector for plotting color |
... |
arguments to be passed to methods, such as graphical parameters ( |
data(spider) # single-assemblage abundance data out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") plot(x=out1, type=1) plot(x=out1, type=2) plot(x=out1, type=3)
data(spider) # single-assemblage abundance data out1 <- iNEXT(spider$Girdled, q=0, datatype="abundance") plot(x=out1, type=1) plot(x=out1, type=2) plot(x=out1, type=3)
print.iNEXT
: Print method for objects inheriting from class "iNEXT"
## S3 method for class 'iNEXT' print(x, ...)
## S3 method for class 'iNEXT' print(x, ...)
x |
an |
... |
additional arguments. |
The data include spider species abundances in two canopy manipulation treatments (Girdled and Logged) of hemlock trees (Ellison et al. 2010, Sackett et al. 2011). In the Girdled treatment site, there were 26 species among 168 individuals; in the Logged treatment site, there were 37 species among 252 individuals.
data(spider)
data(spider)
The format for each site is a list of species abundances:
A list of 2 vectors
$ Girdled: num [1:26] 46 22 17 15 15 9 8 6 6 4 ...
$ Logged : num [1:37] 88 22 16 15 13 10 8 8 7 7 ...
Ellison, A.M., Barker-Plotkin, A.A., Foster, D.R. & Orwig, D.A. (2010) Experimentally testing the role of foundation species in forests: the Harvard forest hemlock removal experiment. Methods in Ecology and Evolution, 1, 168-179.
Sackett, T.E., Record, S., Bewick, S., Baiser, B., Sanders, N.J. & Ellison, A.M. (2011) Response of macroarthropod assemblages to the loss of hemlock (Tsuga canadensis), a foundation species. Ecosphere, 2, art74.