2

I have a dataset from one site containing data on species and its abundance (number of individuals for each species in sample). I use vegan package for alpha diversity analysis. For instance, I plot a species rarefraction curve via rarecurve function (I cann't use a specaccum function becouse I have data from one site), and calculate a Chao1 index via estimateR function.

How I can plot a Chao1 expected richness curve using estimateR function? Then, I would like to combine these curves on one single plot.

library(vegan)
TR <- matrix(nrow=1,c(3,1,1,17,1,1,1,1,1,2,1,1,3,13,31,24,6,1,1,4,1,10,2,3,1,5,6,1,1,1,4,16,17,15,6,9,66,3,1,3,24,15,2,3,17,1,7,2,27,13,2,1,1,3,1,3,30,7,1,1,4,1,2,5,1,1,6,2,1,9,11,5,8,7,2,2,2,1,13,3,8,4,1,5,27,1,62,13,6,7,7,4,9,1,7,7,1,25,1,5,3,1,2,1,1,5,2,73,25,17,43,88,2,3,38,4,5,6,6,16,2,13,10,7,1,2,9,3,1,3,1,8,4,4,5,13,2,25,9,2,1,12,29,4,1,9,1,1,3,4,2,9,4,26,2,7,4,18,1,10,10,4,6,5,20,1,2,11,1,3,1,2,1,1,12,3,2,1,4,24,7,22,19,43,2,9,18,1,1,1,9,7,6,1,8,2,2,19,7,26,4,4,1,3,4,5,2,4,8,2,3,1,5,5,1,11,6,6,2,4,3,1,10,6,9,16,1,1,32,1,1,31,2,12,2,13,1,2,9,13,1,11,8,1,14,5,9,1,3,1,7,1,1,13,17,1,1,3,2,9,1,4,1,7,2,2,9,24,20,2,1,2,2,1,9,5,1,1,23,13,7,1,8,5,47,32,6,13,16,8,2,1,5,4,3,1,2,1,1,1,3,14,6,21,2,7,2,2,16,2,10,21,18,2,1,3,33,12,55,4,1,5,14,3,10,2,4,1,2,5,7,6,2,12,14,28,18,30,28,7,1,1,1,3,4,2,17,60,31,3,3,2,2,3,6,2,6,1,13,2,3,13,7,2,10,19,9,7,1,3))
num_species=specnumber(TR)
chao1=estimateR(TR)[2,]
shannon=diversity(TR,"shannon")
rarecurve(TR)
estimateR(TR)

Here is a plot, building on EstimateS output (I input the same data) with SigmaPlot:

Individual-based species accumulation curve (SAC) (thick line) and the Chao 1 estimator (thin line) of expected richness;

Thin line is expected richness - Chao1. In R I can plot only SAC. In EstimateS I get a set with data for all 2990 individuals, but not in R.

  • Welcome to Stack Overflow! Can you please include data that will provide us with a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) ? – Ben Bolker Nov 25 '16 at 13:35
  • Off-site links are not preferred. You can simply edit your question to include `sp_data <- matrix(nrow=1,c(3,1,1,17,1,1,1,1,1,2,1,1,3,13,31,24,6,1,1,4,1,10,2,3,1,5,6,1,1,1, 4,16,17,15,6,9,66,3,1,3,24,15,2,3,17,1,7,2,27,13,2,1,1,3,1,3,30,7, 1,1,4,1,2,5,1,1,6,2,1,9,11,5,8,7,2,2,2,1,13,3,8,4,1,5,27,1,62,13,6, 7,7,4,9,1,7,7,1,25,1,5))` (I picked the first 100 species from your data). – Ben Bolker Nov 25 '16 at 15:11
  • can you define / point to a definition of a "Chao1 estimate curve"? – Ben Bolker Nov 25 '16 at 15:11
  • Do you mean you want to `rrarefy` (hint) your one site and get the Chao-1 for each of the randomly rarefied (hint) sub-sample size? – Jari Oksanen Nov 27 '16 at 15:36
  • You should never say "I can get it .... but not in R": there is no such thing as not getting something in R. There may be a thing of how to get it, but surely you get it. – Jari Oksanen Nov 27 '16 at 15:38

1 Answers1

2

I don't know how things are done in estimateS, but it looks like the extended richness (Chao 1) curve is based on the mean of random subsamples of the community. This could be done like this:

subchao <- sapply(1:2990, function(i) 
   mean(sapply(1:100, function(...) estimateR(rrarefy(TR, i))[2,])))

This would randomly rarefy (rrarefy()) to all sample sizes from 1 to 2990 and find the mean from 100 replicates of each. This will take time.

Jari Oksanen
  • 3,287
  • 1
  • 11
  • 15