The files contained here allow for reproduction of the analysis performed for the paper "Assessing the Recovery of an Antarctic Krill Predator from Historical Exploitation" by Zerbini et al. as submitted to *Royal Society Open Science*. Files included in this repository ================================= 2_2019_Runs ----------- This directory contains the results of running the code as described below. These are the results presented in Zerbini et al. The two Word documents included here summarize the models that were fit. This directory was taken from Fresh_run --------- This directory contains the directory structure, `HumpbackSIR` R package source, and analysis scripts used to generate the files in the `2_2019_Runs` directory. Instructions for reproducing the analysis using this directory structure are described below. HumpbackSIR package ------------------- The code used in the analyses presented in Zerbini et al. was developed at and further developments will be made available there. The exact Git commit used to conduct the analyses in Zerbini et al. is available from The code at the time of this commit is included in the `HumpbackSIR` directory within the `Fresh_run` directory as the source of an R package. Analysis code ------------- The analysis presented in Zerbini et al. was performed using R version 3.5.2. Scripts used used the `HumpbackSIR` package above to generate posterior samples of various parameters using the sample-importance-resample algorithm (see Zerbini et al. for model and fitting details). The version of these scripts used to generate these results is available at and included here in the `R Code` subdirectories. It contains four files: - `2_2019_Model_Average.R`: This script calculates Bayes factors for the different model scenarios that are compared in Zerbini et al. (Section 3.7). - `2_2019_Plots.R`: This script generates the plots used in the paper. - `2_2019_Runs.R`: This script runs each of the model scenarios described in Zerbini et al. and saves the posterior samples to a file for later use. - `InputData_HWAssessment_InitialAssessments_Oct2018.R`: This script contains all of the catch and abundance observations used in the paper, and loads them into the R session. Steps for reproducing the analysis of Zerbini et al. ==================================================== 1. Unzip `Zerbini_et_al_code.zip`. 2. Open R and set the working directory to the `Fresh_run` directory. 3. Within R, run shell("R CMD build HumpbackSIR") install.packages("latex2exp") install.packages("HumpbackSIR_0.0.0.9000.tar.gz", repo = NULL) to install the `HumpbackSIR` package. Note that installation of this package requires a C++ compiler. 4. Open the script `R Code/2_2019_Runs.R`. Run from line 3 to the end. This step may take multiple days to run. Warning messages will be issues about the number of samples per resample. These can be disregarded, as the number of unique samples is checked later to ensure that an adequate posterior sample has been obtained. 5. Run `2_2019_Plots.R` to generate plots used in the paper. 6. Run `2_2019_Model_Average.R` to get model averaged estimates and plots and generate scenario comparison plots. At this point results will be organized into each of the directories by model (see Zerbini et al. for a description of each model specification), along with the model comparisons. These files match those provided in the `2_2019_Runs` directory.