0

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))
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
Fred
  • 1
  • 2
  • This `ls(pattern = "sp.")` part is too undifferentiated to be very robust - it actually picks up a custom function in my workspace the name of which contains the string `sp` and the script then fails. Try something more likely to be unique, like `spvegantest.` instead. Either way, it would be good if you could (a) show us what code you have already written for the plot and (b) link to an image showing what kind of output you're aiming at. It's hard to visualise what you want. – SlowLearner Nov 18 '13 at 12:42
  • Ok @SlowLearner I edited the code to avoid script failure. What you basically get with vegan SAC it's either the cumulative number of species as a function of number of samples(or sites) or individuals. Here, I'd like to use a different type of effort (number of hooks). – Fred Nov 18 '13 at 13:35

2 Answers2

1

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.

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

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)
}
SESman
  • 238
  • 2
  • 9