Fred
Fred

Reputation: 1

R: Species accumulation curve based on variable effort

I am trying to construct a Species Accumulation Curve using a fishery dataset. It can be done easily using packages such as Vegan. However, I'd like construct a curve based on a different type of effort (here number of hooks) than the common type such as samples or individuals sampled. I couldn't find a way to change the effort type. Is there a package where this kind of modification can be done?

An example of toy dataset. species sampled and number of hooks

for (i in 1:50){
  set.seed(645)
  aaa <- data.frame(sample(1:100, 100, replace=TRUE))
  names(aaa) <- paste("spvegantest.",i,sep="")
  assign(paste("spvegantest.",i,sep=""),aaa)}
list_sp <- lapply(ls(pattern="spvegantest."), get)
dataset <- data.frame(Sample_ID= 1:100, list_sp, Nhooks = sample(500:2500, 100, replace=TRUE))

Upvotes: 0

Views: 2252

Answers (2)

Jari Oksanen
Jari Oksanen

Reputation: 3682

The R-Forge and github versions of vegan have added an argument for weights in species accumulation (specaccum() function). This is from the documentation:

w: Weights giving the sampling effort.

You could try this version (but then you need to be able to to build the package yourself: R-Forge is just too dysfunctional to provide a package).

The w argument for weights was added because somebody asked for that. It was not yet released because the person asking the addition lost the interest and never tested if this was what was needed. If you test this and find it useful, it will go to the release.

Upvotes: 1

SESman
SESman

Reputation: 238

If I well understand, you want to plot the Species Richness vs. Sampling effort from a contingency table of species individuals found within different samples. I am not familiar with the vegan package but you can bootstrap your data as following. In the second example you could try to increase number of points by adding another loop which makes several sampling at each step of i.
A real data curve is supposed to look like a sqrt function while here it is flat since every sample contains all species. In fisheries fishing effort is often measured in number of boat x days at sea, boats supposed to have the same Trawled area, number of hooks or total length of fishing lines are other common measures.

count.sp <- function(sample.vec, dataset){
   sample.presence <- dataset[sample.vec, grep("sp.", names(dataset))] != 0
   overall.presence <- apply(sample.presence, 2, sum) != 0
   n.species <- sum(overall.presence)
   return(n.species)
}

# Sampling effort = number of sample
plot(c(0, nrow(dataset) - 1), c(0, 1.5*length(grep("sp.", names(dataset)))), type="n",
     xlab="Sampling effort", ylab="Species richness")
for (i in 1:(nrow(dataset) - 1)){
    sample.vec <- sample(seq(along=dataset$Sample_ID), i)
    points(i, count.sp(sample.vec, dataset), pch=19, cex=0.5)
}

# Sampling effort = number of hooks
plot(c(0, sum(dataset$Nhooks)), c(0, 1.5*length(grep("sp.", names(dataset)))), type="n",
     xlab="Sampling effort", ylab="Species richness")
for (i in 1:(nrow(dataset) - 1)){
    sample.vec <- sample(seq(along=dataset$Sample_ID), i)
    points(sum(dataset$Nhooks[sample.vec]), count.sp(sample.vec, dataset), pch=19, cex=0.5)
}

Upvotes: 0

Related Questions