README.md

bwgbiomass : estimating biomass from allometry data

Uses the BWG allometry data to estimate biomass for available species.

Installation

devtools::install_github("ropenscilabs/datastorr")
devtools::install_github("SrivastavaLab/fwdata")
devtools::install_github("SrivastavaLab/bwgbiomass")

Usage

Acquire the latest release of allometry data or biomass data

# Acquire the latest allometry data release

allometry_data <- allometry()

# Acquire the latest bwgbiomass data release

biomass_data <- biomass()

Generate the biomass table fresh

biomass_data <- gen_biomass()

You can also create intermediate data frames needed to generate the final biomass table. See documentation below for a description of the data frames and the columns they contain:

# The allometry matrix

allometry_matrix <- create_allometry_matrix()

# The equation bank:

equation_bank <- create_equation_bank()

# The category lookup table:

category_lookup <- create_category_lookup()

# The biomass table cleared of original biomass info:

biomass_table <- create_biomass_table()

To do a data comparison with the original biomass estimates:

# Get the latest data

biomass_data <- biomass()

# Do the data check

check_data <- sanity_check(biomass_data)

Data Version Numbering

Data versions are numbered with a bwgbiomass version and an allometrydata version.

For example:

v.0.0.1_0.0.1

The numbers before the _ indicate which version of bwgbiomass is being used. When updates are made to the bwgbiomass code, this number will change. The numbers after the _ indicate which version of the allometry data was used. When allometry data are added or changed, this number will change.

Documentation

General Assumptions

Allometric equations

Allometric equations are calculated by linear regression of log10(mass_mg) against log10(length_mm).

95% confidence intervals were computed for biomass predictions.

Provenance

To determine biomass, species from the biomass table are looked up in the allometry matrix. The size specified in the biomass table is matched to the allometry matrix. If not found, it is either derived using an equation bank, or derived using the closest taxonomic relative.

Biomass was determined in the following order, with the meanings of provenance defined below:

  1. length.raw: Exact length was found in the allometry matrix and used directly to determine biomass
  2. length.interp: Length was used to interpolate biomass from the equation bank
  3. category.raw: Size category was used to look up a length estimate, which was found in the allometry matrix. Raw biomass was used based on that length estimate.
  4. category.interp: Size category was used to look up a length estimate, which was not found in the allometry matrix. Biomass was interpolated based on that length estimate, using the equation bank.

Meanings of provenance_species:

  1. exact: Exact species was found in the allometry matrix
  2. related: The most closely related species (taxonomically) from the allometry matrix was used

Computing biomass when there is more than one closest relative

When more than one closest relative was available, those relatives with highest quality data were prioritized, and median biomass taken. Following the order of provenance above:

  1. Look for relatives with length_mm matching the length_mm of the target species in the biomass table. If only one relative had a matching length_mm, this was used. If more than one relative was found, the median biomass was used. Provenance length.raw was assigned. If no relatives were found, go to step 2.
  2. Look for relatives with an equation in the equation bank. Biomass of all relatives was computed using the length_mm of the target species in the biomass table. The median of computed biomasses was used and provenance length.interpolate assigned.
  3. If the target species has only length_est_mm, look for relatives with length_mm matching the length_est_mm of the target species in the biomass table. The median of all such relatives was used and provenance category.raw assigned. If no relatives were found, go to step 4.
  4. Look for relatives with an equation in the equation bank and calculate biomass using length_est_mm. Use the median of calculated biomasses.

If no relatives were found in any of the steps, no biomass was assigned.

All close relatives used to compute a median biomass are named in closest_relative. Because of the way median was computed, the number of species named in closest_relative may differ from the number in num_relatives.

Dry biomass was always prioritized over wet biomass.

If two species had the same median biomass, the lower value was used. This gives a more conservative biomass estimate.

Output

Description of output files and column meanings

Allometry matrix

The allometry matrix generated by create_allometry_matrix(): The imported and joined XLS files; column descriptions here are copied from the XLS template where possible

Equation bank

The allometric equation bank, generated with the function create_equation_bank()

Category lookup table

The category lookup table for matching a category to a length estimate, generated with the function create_category_lookup()

Biomass table

The biomass table acquired from Dropbox and cleared of biomass measurements, generated with the function create_biomass_table()

Biomass estimates table

The full table of new biomass estimates, using the function gen_biomass()

Data check

Comparison of biomass measurements with Jana's values (from the original table). Generated using the function sanity_check()

Future Improvements

The package is currently very reliant on other packages to function. This makes it on the heavy side.

License

MIT + file LICENSE



SrivastavaLab/bwgbiomass documentation built on May 31, 2019, 4:53 a.m.