Visualize completeness of biodiversity data

10 Jun

Package bdvis: Biodiversity data visualizations using R is helpful to understand completeness of biodiversity inventory, extent of geographical, taxonomic and temporal coverage, gaps and biases in data. Package bdvis version 0.2.6 is on CRAN now. This version has several features added since version 0.1.0. I plan to post set of blog entries here to describe some of the key features of the package with some code snippets.

The function bdcomplete computes completeness values for each cell. So after dividing the extent of the dataset in cells (via the getcellid function), this function calculates the Chao2 estimator of species richness. In simple terms, the function estimates looking at the data records in each cell and how many species are represented, how complete that dataset.

The following code snippet shows how the data downloaded from Global Biodiversity Information Facility GBIF Data Portal. The .zip file downloaded using the portal has a file occurrence.txt which contains the data records. Copy that file in the working folder and try the following script.

library(bdvis)

# Download GBIF data from data.gbif,org portal and
# extract occurrence.txt file in Data folder
occurrence <- read.delim( 'occurrence.txt',
                         quote='', stringsAsFactors=FALSE)
# Set configuration variables to format data
conf <- list(Latitude='decimalLatitude',
             Longitude='decimalLongitude',
             Date_collected='eventDate',
             Scientific_name='specificEpithet')
occurrence <- format_bdvis(occurrence, config=conf)
# Compute completeness and visualize using mapgrid
comp=bdcomplete(occurrence)
mapgrid(comp,ptype='complete')

The completeness function produces a graph showing Completeness vs number of Species. More points in higher range of completeness indices indicates better data.

 Completeness vs Species

Completeness vs Species

Now to visualize the data spatially, if any particular region needs better sampling the function mapgrid can now be used with ptype = “complete” parameter. This plots all the grids that have data records more than recs parameter (default = 50) using a color range from light purple to dark blue. Darker the color better the data in that cell.

Completeness Visualization

Completeness Visualization

References:

Advertisements

4 Responses to “Visualize completeness of biodiversity data”

  1. Fabricio Villalobos June 10, 2016 at 6:15 pm #

    Congrats Vijay! Great and very useful work! I have one doubt. In your bdcomplete function, I noticed that you use an extra parameter (m) for estimating Chao2. This parameter seems to be related to “Date_Collected”. Can you explain me why is this necessary?
    Also, I wanted to ask you if you have thought/implemented a similar approach but for comparing different sites/cells via species accumulation/rarefaction curves?
    Thanks! Say hi to the family!

    • vijaybarve June 10, 2016 at 7:49 pm #

      Thanks @Fabricio.
      If I remember correctly m-1/m is for bias correction. But I will have to look it up. It has been some time since I programmed this function.

    • Alex Ponce June 11, 2016 at 1:50 am #

      Hi Fabricio,
      probably you can try with vegan for rarefraction… I did a little function for that. I hope that it is helpful for you

      RarefraccionCC <- function(Tabla,factor){
      require(vegan)
      Tabla1 <- data.frame(Tabla, row.names=factor)
      #Tabla1 <- decostand(Tabla1, "pa")
      raremax <- min(rowSums(Tabla1))
      col1 <- seq(1:nrow(Tabla1)) #Para poner color a las lineas
      lty1 <- c("solid","dashed","longdash","dotdash")
      rarecurve(Tabla1, sample = raremax, col = "black", lty=lty1, cex = 0.6)
      #Para calcular el numero de especies de acuerdo a rarefraccion
      UUU <- rarefy(Tabla1, raremax)
      print(UUU)
      }

      • Fabricio Villalobos June 13, 2016 at 2:11 pm #

        Thanks, Alex! I’ll take a look. Gracias!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: