Introduction
Theory, R functions & Examples
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:
packages dealing with rarefaction/accumulation curves: vegan, rich, iNEXT,
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.