knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 6 )
library(sizeSpectra)
This R package contains functions for fitting size spectra to ecological data. In particular, it contains functionalised code to reproduce all the results in [1] and [2], and for users to apply the methods to their own data.
[1] Testing and recommending methods for fitting size spectra to data by Andrew M. Edwards, James P. W. Robinson, Michael J. Plank, Julia K. Baum and Julia L. Blanchard. Methods in Ecology and Evolution (2017, 8:57-67). Freely available at http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12641/full.
[2] Accounting for the bin structure of data removes bias when fitting size spectra by Andrew M. Edwards, James P. W. Robinson, Julia L. Blanchard, Julia K. Baum and Michael J. Plank. Marine Ecology Progress Series (2020, 636:19-33). Freely available at https://www.int-res.com/abstracts/meps/v636/p19-33/.
The vignettes explain how to use the functions in the package to reproduce the results in both papers. Users should look over the vignettes to determine which functions and code are best suited for analysing their own data. The vignettes are descriptions of how to use the code to implement the methods. The two papers should be consulted first to understand the methods (I have tried to avoid repeating explanatory text from the papers in the vignettes). In the vignettes, [1] is referred to as the 'MEE paper' and [2] as the 'MEPS paper'.
The vignettes are:
MEE_reproduce_1.html: Simulate and fit a single data set using eight methods, and create recommended likelihood-based plot. Reproduces MEE Figures 1, 2, 6 and A.1.
MEE_reproduce_2.html: Simulate 10,000 data sets and fit them using eight methods, then plot histograms and confidence intervals of the estimates of the size-spectra exponent $b$. Reproduces MEE Figures 3 (except currently for the gold histograms), 4 and Table 2. Also for the MLEfix method (Figures A.3 and A.4).
MEPS_reproduce_1.html: Example length-weight relationships for two species and the effect of binned length data (MEPS Figure 2). And how consequent binned body-mass values get assigned to logarithimic size-class bins by some methods (Figure 3).
MEPS_reproduce_2.html: Main simulation results, from fitting maximum likelihood value (and confidence interval) of $b$ for each combination of 10,000 simulated data sets, four binning methods and two fitting methods (MLEmid or MLEbin). Reproduces MEPS Figures 4 and 5 and Table S.3. Then does the same analyses with $x$~min~$=16$ (Figures S.35 and S.36 and Table S.4), and with with $x$~min~$=1$ but only sampling above a cutoff value of 16 (Figures S.37 and S.38 and Table S.5).
MEPS_IBTS_1.html: Pre-processing of International Bottom Trawl Survey (IBTS) data to extract the required elements. Gives MEPS Table 1.
MEPS_IBTS_2.html: Analyses of the IBTS data using the original eight methods. Gives MEPS Figure 1 and Table S.1.
MEPS_IBTS_MLEbins.html: Analyse the IBTS data using the MLEbins method. Gives Figure 6 (and related Figures S.1, S.2 and S.3) showing species-specific body mass bins resulting from the length bins, Figure 8 (comparison of MLE and MLEbins values of b through time), MLEbins row of Table S.1, and Table S.2.
MEPS_IBTS_recommend.html: Calculations and schematic diagram (Figure S.4, somewhat automated for any species) to help explain the recommended plotting approach. The recommended Figures 7, and S.5 to S.34 for each year of the IBTS data (with code for doing separate figures and as a movie).
MEPS_IBTS_all_min_100.html: Combines the essential aspects of the above four IBTS vignettes into one, and repeats the analysis but setting the minimum body mass to be 100 g. Less for understanding everything and more for redoing the analyses with different assumptions (or data).
MLEbin_recommend.html: Exploring ways of plotting an LBN type plot for data that are binned with one set of bin breaks (so simpler than the IBTS data). Not part of any paper.
The source code written in Rmarkdown
, the R code that gets extracted from the
Rmarkdown
code, and the resulting .html files are all found within your library
folder (where all your R libraries get saved), in
library\sizeSpectra\doc\
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.