Calculate abundance, richness, and diversity from count data.

Combine survey and count data

In the situation that some surveys had no birds observed, there will be no entry in the avian_common_count data set. Thus, we combine this data set with the avian_surveys data set to insure that all surveys are represented. The following step, which fills in zeros for any species not observed during a particular survey, is unnecessary for calculation of abundance, richness, and diversity but will likely be helpful for other tasks, e.g. abundance or occupancy modeling.

library(dplyr)
library(tidyr)
library(STRIPSSchulte)

all_counts <- avian_common_count %>%
  right_join(avian_surveys[,"survey"], by="survey") %>% # include surveys with no observations
  complete(survey, abbrev, fill = list(count=0))        # fill all missing survey-abbrev combinations with zero counts

Calculate abundance, richness, and diversity

The vegan package has functionality to calculate Shannon, Simpson, and inverse Simpson measures of diversity. For avian populations, we typically use inverse Simpson diversity, but there is an issue with defining diversity when no individuals of any species are observed. We propose (perhaps it is already used or there is a different solution) to define inverse Simpson diversity to be 0 when there are no individuals of any species observed.

diversity <- function(x) {
  div <- vegan::diversity(x, index = "inv") # Inverse Simpson's Diversity
  div[is.infinite(div)] <- 0
  return(div)
}
all_counts %>%
  group_by(survey) %>%
  summarize(abundance = sum(count),
            richness  = sum(count>0),
            diversity = diversity(count)) 


ISU-STRIPS/STRIPSSchulte documentation built on May 7, 2019, 6:36 a.m.