# Run the following to properly build for inclusion in package
library(devtools)
devtools::build_vignettes()
library(captioner)
tbls <- captioner::captioner(prefix="Table")
tbls(name="LRIBI_Table1.png","Metrics used in the Wisconsin large-river index of biotic integrity (IBI).  Species designations for each category may be seen by typing `LRIBI_AppendixA` in R. This is modified from Table 1 in Lyons *et al.* (2001).")
tbls(name="LRIBI_Table3.png","Metrics and scoring criteria for the Wisconsin large-river index of biotic integrity (IBI). This is Table 3 in Lyons *et al.* (2001).")
library(knitr)
opts_chunk$set(fig.width=5,fig.height=5,out.width='300pix',prompt=TRUE,comment="")

Background

An index of biotic integrity (IBI) is a single value that may be used to assess aquatic communities and evaluate restoration efforts within those communities (Fausch et al. 1990; Karr and Chu 1999). An IBI accounts for the structure, composition, and functional organization of the biological community. The IBI can aid in understanding the relationship between the biological community and the amount of environmental degradation and can be viewed as a quantitative empirical model to assess the health of a given system (Lyons et al. 2001).

Description of the IBI of Lyons et al. (2001)

Simon and Lyons (1995) noted that few IBI had been developed for large rivers (they were aware of only seven studies). The lack of IBI for these systems was largely due to the difficulty of characterizing fish assemblages in large rivers, as well as a paucity of undegraded reaches needed to estimate expected conditions (Simon and Lyons 1995; Reash 1999). To address this issue in Wisconsin, Lyons et al. (2001) designed an IBI to assess the quality of fish assemblages in Wisconsin's large rivers. Lyons et al. (2001) chose ten (from 26) metrics (note that six metrics differed between North and South ecoregions; Table 1) to use in the IBI based on their variation relative to natural factors, their relation to anthropogenic impact, and whether they represented an aspect of the structure, composition, or functional organization of the fish community. Moreover, at least one of the ten metrics represented each of the five attributes of fish assemblages (i.e., species richness and condition, indicator species, trophic function, reproductive function, and individual abundance and condition) that an IBI should encompass (Simon and Lyons 1995).


r tbls("LRIBI_Table1.png")


Least-impacted (i.e., low degradation) and multiple-impacted (i.e., high degradation) systems were used to develop scoring criteria for the ten metrics, with the assumption that the least-impacted systems would result in the highest scores. A maximum score of 10 was assigned when the value of a metric exceeded approximately 75% of the values observed for the least-impacted systems. A minimum score of 0 was assigned when the value of a metric fell below approximately 25% of the observed values for the multiple-impacted systems. Intermediate values were assigned a score of 5. The range of values used to assign these scores for each metric are in Table 2.


r tbls("LRIBI_Table3.png")


With this system, an IBI score could range between 100 (score of 10 for each of the ten metrics) and 0. Lyons et al. (2001) considered scores of ≥80 as excellent, 60-79 as good, 40-59 as fair, 20-39 as poor, and <20 as very poor. Due to naturally low diversity of Catostomids in Lake Superior and some Lake Michigan tributaries, Lyons et al. (2001) used only the eight "nonsucker" metrics for those systems, with the final score multiplied by 1.25 (i.e., 10/8) to achieve the same scoring range.

Description of Required Data Files

The R function described below for computing the Wisconsin Large-River IBI is designed to work with data files downloaded directly from the Wisconsin Department of Natural Resources' Fisheries Management Database (FMDB). For any given IBI effort (currently denoted in the database by having target species = Z100, or all species), the required data files that should be downloaded are the raw fish data table, the raw effort data table, and the aggregate fish data (catch summary) data table. The raw fish data and effort tables can be downloaded from the reporting module of the database in .csv format, while the catch summary data table must be downloaded from the data entry module in Excel format. We will be working to create an aggregate data download from the reporting module in the near future.

While the function is designed to work on a single survey at a time (one set of downloaded data from an individual waterbody survey), we have plans to augment the function to have the capacity to run multiple scores for multiple surveys at one time, with a multiple survey report.


Preliminaries

Loading fishWiDNR package

Special purpose functions for computing the Wisconsin Large-River IBI of Lyons et al. (2001) are in the fishWiDNR package. The fishWiDNR package must be installed on your machine as described here. Once installed, the package must be loaded with library() each time you start R and wish to compute the Large-River IBI.

library(fishWiDNR)

Setting Directory for Survey Data

Methods described below for computing the Large-River IBI require all data files related to a fish collection survey to be in the same directory (folder). R must be told where this directory is with setwd(). In the example below, the directory was set to the "WolfRiver" folder inside the "Data" folder inside the "IBI" folder on the "C:" drive.

# -----------------------------------------------------------------------------
# This code is hidden from the user and is needed to make this compile from
#  the fishWiDNR package directory
dir <- dirname(system.file("extdata","aggdata_Survey375049456.csv",package="fishWiDNR"))
fmdb.df <- read.FMDB(paste0(dir,"/fish_raw_data_Survey375049456.csv"),expandCounts=TRUE)
agg.df <- read.csv(paste0(dir,"/aggdata_Survey375049456.csv"))
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Only one of the following two setwd()s is required. See vignette text.
setwd("C:/IBI/Data/WolfRiver")

On Windows, the directory may be chosen interactively (i.e., through a dialog box), which may be useful for long directory paths, with setwd(choose.dir()).

setwd(choose.dir())

Only one of the two methods used above is needed to set the working directory.

Read in needed data files

The FMDB and aggregate files need to be loaded into a data.frame to compute the IBI (demonstrated below). The FMDB file is loaded with read.FMDB(), whereas the aggregate file uses read.csv(). Both read.FMDB() and read.csv() require the name of the external file in quotes as the first argument. Additionally, read.FMDB() MUST HAVE expandCounts=TRUE to expand records that represent the same length for multiple fish to records that represent individual fish. The need for expandCounts=TRUE is explained further in the documentation of read.FMDB() (i.e., run ?read.FMDB() in the console). Both the FMDB and aggregate data files are saved into objects (i.e., fmdb.df and agg.df) for use in R.

fmdb.df <- read.FMDB("fish_raw_data_Survey375049456.csv",expandCounts=TRUE)
agg.df <- read.csv("aggdata_Survey375049456.csv")



Compute IBI

The LRIBI() function is used to compute the Wisconsin Large-River IBI. The first two arguments to LRIBI() are the FMDB and aggregate data.frames. The effort (in miles) expended on the survey must be given to effort=. The results from LRIBI() should be saved to an object (res below) so that specific results can be extracted (as shown in the following sections).

res <- LRIBI(fmdb.df,agg.df,effort=0.9)

Several optional arguments may also be used with LRIBI(). LRIBI() will identify the ecoregion (from the county) in which the survey was conducted. Some counties are in both ecoregions and, in these instances, the ecoregion will need to be specified with either region="North" or region="South". A warning will be issued when a county is in both ecoregions and region= was not specified.

The values in Table 2 imply that most metric values were rounded to whole numbers (some were rounded to one decimal) before converting to IBI scores. By default, metric values are rounded prior to comparing to Table 2. However, rounding is suppresed with round=FALSE if needed for comparing results of LRIBI() to other programs.

Lyons et al. (2001) noted that the two sucker metrics should not be used for Lake Superior and some Lake Michigan tributaries. These metrics can be excluded from the analysis by including excludeSuckers=TRUE in LRIBI().

Overall IBI

The IBI value for the given data is extracted from the saved LRIBI() object with coef().

coef(res)

Summary Tables

Specific results used to compute the overall IBI (i.e., metric values, ratings, and scores, and observed species count, total biomass, and DELT count) are extracted from the saved LRIBI() object with summary().

summary(res)

The metric results (i.e., values, ratings, and scores) can be excluded using intermediate=FALSE and the observed data (i.e., species count, total biomass, and DELT count) can be excluded by using show.data=FALSE in summary().

Summary Plots

A plot of the IBI metric scores may be constructed from the saved LRIBI() object with plot(). This plot will show each metric value (with the exception of "% DELT (n)") color coded by metric rating ("good" (10) is green, "fair" (5) is yellow, and "poor" (0) is red), and with metric score cutoff values shown as horizontal dashed lines.

plot(res)

A barplot of individual metric ratings may be constructed from the saved LRIBI() object by including type="ratings" in plot(). The color coding here is the same as that described for the previous plot.

plot(res,type="ratings")

Barplots of observed species counts and total biomasses (kg) may also be constructed with plot() by using type="counts" or type="biomass", respectively. Optionally, the range of the x-axis may be controlled by setting xlim= to a vector that contains the minimum and maximum values for the x-axis. For example, the x-axis for the left plot below is set to be from 0 to 80.

plot(res,type="counts",xlim=c(0,80))
plot(res,type="biomass",xlim=c(0,25))

For some surveys, there may be discrepancies between the raw fish data and aggregate data files when the data are entered incorrectly. The LRIBI() function will issue a warning when such discrepancies are detected. Assistance for identifying those specific discrepancies can be extracted from the saved LRIBI() object with problemsLRIBI(). No discrepancies between the two files were found for this survey as shown below. An example with a discrepancy is shown in the next section.

problemsLRIBI(res)



Compute IBI (with Data Discrepancies)

As noted in the previous section, LRIBI() will issue a warning when a discrepancy between the FMDB and aggregate files is detected. To demonstrate this, FMDB and aggregate data from a different survey are loaded.

# -----------------------------------------------------------------------------
# This code is hidden from the user and is needed to make this compile from
#  the fishWiDNR package directory
dir <- dirname(system.file("extdata","aggdata_Survey375334018.csv",package="fishWiDNR"))
fmdb.dfB <- read.FMDB(paste0(dir,"/fish_raw_data_Survey375334018.csv"),expandCounts=TRUE)
agg.dfB <- read.csv(paste0(dir,"/aggdata_Survey375334018.csv"))
# -----------------------------------------------------------------------------
fmdb.dfB <- read.FMDB("fish_raw_data_Survey375334018.csv",expandCounts=TRUE)
agg.dfB <- read.csv("aggdata_Survey375334018.csv")

As seen in the warning message below, LRIBI() will make a decision (here to continue with the counts from the FMDB file) to continue with the IBI calculation. Thus, despite this warning, one can still extract information with coef() (demonstrated below), summary(), and plot() in the same manner as shown in the previous section. [Note that these are different data files than were used in the previous example.]

res <- LRIBI(fmdb.dfB,agg.dfB,effort=0.9)
coef(res)

Although the calculation continued despite the data file discrepancies, it may be useful for the purposes of correcting the discrepancies to specifically identify where the discrepancies occurred. For example, this survey has discrepancies between the raw and aggregate data files for counts of Common Shiners, Northern Hog Suckers, and White Suckers.

problemsLRIBI(res)

A final word of caution, LRIBI() will continue to compute the IBI in the presence of these discrepancies. Different data may lead to different metric scores, which may ultimately change the overall IBI score and management decision. Thus, data file discrepancies should be corrected in the original database sources.




References



droglenc/fishWiDNR documentation built on May 15, 2019, 2:51 p.m.