 Analysis of community ecology data in R

David Zelený

Others

Author: David Zelený en:alpha_beta_diversity

Diversity analysis Plan: Divide the chapter into alpha+gamma diversity section and beta diversity section. One option - use Jurasinsky et al 2009 schema and talk about inventory, differentiation and proportional diversity (inventory = alpha and gamma, differentiation = based on dissimilarity measures, incl. variation within compositional matrix and length of DCA axis; proportional - gamma vs alpha, additive vs multiplicative, using Hill's numbers for it etc.) Other option is to divide the whole topic into several chapters:

1. alpha diversity (inventory diversity)
1. includes species richness, Shannon entropy, Simpson concentration index, Hill's numbers, effective number of species
2. rarefaction and accumulation curves, estimates of unseen species
3. beta diversity
1. differentiation diversity - Legendre's approach, incl. LCBD, mean of pairwise dissimilarity indices, multisite dissimilarity indices
2. proportional diversity - Whittaker's beta, beta based on Hill's numbers, Chao's beta diversity (beta differentiation)

Rarefaction and accumulation curves

Dictionary of terms:

• Rarefaction curves answers the question “what would be the number of species in community if we sampled less individuals/samples”, while accumulation curves shows whether we sampled enough (the curve flattens to asymptote) or we haven't (curve still steeply climbing up).
• Accumulation curve can be extrapolated to get hypothetical richness of larger sample or species pool, while rarefaction curve is basically an interpolation.
• Individual- vs sample- (incidence) based data: while individual-based data represent vector with number of individuals recorded for each species in single representative sample of the community, sample-based data consist of a set of sampling units (plots, traps, quadrats, transects), where incidence (presence) of species is recorded for each sampling unit.

packages dealing with rarefaction/accumulation curves: vegan, rich, iNEXT,

R functions

• `specaccum` (library `vegan`) - calculates accumulation curve on the community data matrix (one curve per matrix); `plot` draws the result (optionally with confidence interval).
• `rarecurve` (library `vegan`) - draws rarefaction curves (each row of the matrix is one curve), without confidence intervals.
• `rarefy` (library `vegan`)
• `rarc` (library `rich`)
• `iNEXT` (library `iNEXT`)
```beetles <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/carabid-beetles-boreal-forest.txt', row.names = 1)

rarecurve (t(beetles))

# draw rarefaction curve with confidence intervals

rarecurve.ci <- function (x, step.ci = 1)
{
rar.temp <- apply (com, 1, FUN = function (x) rarefy (x, se = T, sample = 1:sum (x)))
plot.new ()
plot.window (xlim = c(1, max (rowSums (com))), ylim = c(1, max (rowSums (com > 0)) ))
box ()
axis (1)
axis (2)
for (i in seq (1, length (rar.temp)))
{
y <- rar.temp[[i]]
points (y[1,], type = 'l', col = i)
col.ci <- rgb(red = col2rgb (i)[1,], green = col2rgb (i)[2,], blue = col2rgb (i)[3,], alpha = 100, max = 255)
for (x.coord in seq (1, length (y[2,]), by = step.ci))
lines (x = c(x.coord, x.coord), y = c(y[1, x.coord] + 1.95*y[2, x.coord], y[1, x.coord] - 1.95*y[2, x.coord]),
col = col.ci)
}
}

rarecurve.ci (t(beetles))
```

iNext package of Chao et al. 2014, maintained by Hsieh T.C. (謝宗震), offers drawing of rarefaction curves with intra- and extrapolation options and confidence intervals. Additionally to rarefied species richness (of Hill numbers 1, 2 and 3) it also calculates sample completeness (coverage) and allows to standardise samples by completenes. More details in this blog post.

• 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. 