The following describes the workflow to obtain bottom trawl survey input sample size (ISS) for composition data that is used in AFSC stock assessments.
Step 1. Connect to VPN or network.
Step 2. Download the surveyISS
package
(assuming that you have the devtools
package
installed).
library(devtools)
devtools::install_github("BenWilliams-NOAA/surveyISS")
Step 3. Load the surveyISS
library.
Step 4. Query the data for your stock. The following is an example for GOA Pacific cod:
data <- surveyISS::query_data(survey = 47,
region = 'goa',
species = 21720,
yrs = 1990)
There are a couple of special cases that can be integrated within the
surveyISS::query_data()
function that should be noted.
First, for stock complexes, data for multiple species can be pulled at once. The following is an example for the AI Blackspotted-Rougheye rockfish complex:
data <- surveyISS::query_data(survey = 52,
region = 'ai',
species = c(30050, 30051, 30052),
yrs = 1991)
Second, the surveyISS::query_data()
function can pull
multiple survey regions and combine the data into a single dataframe.
The following is an example for Walleye pollock sampled in the NBS and
EBS survey regions:
data <- surveyISS::query_data(survey = c(98, 143),
region = 'nebs',
species = 21740,
yrs = 1982)
For further details on the surveyISS::query_data()
function, including the data that are pulled and description of the
arguments please see the R Documentation. The data that is pulled will
be saved as csv files within a subfolder of the data
folder
which is defined as whatever you specified region
to be in
the surveyISS::query_data()
function (e.g., for the GOA
Pacific cod example the data would be written to the
data\goa
folder).
Step 5. Run the surveyISS::srvy_iss()
function
to obtain ISS for your stock. The following is an example for standard
age and length composition ISS using the GOA Pacific cod example in
Step 4 (with 10 iterations as a test):
surveyISS::srvy_iss(iters = 10,
lfreq_data = data$lfreq,
specimen_data = data$specimen,
cpue_data = data$cpue,
strata_data = data$strata,
yrs = 1990,
boot_hauls = TRUE,
boot_lengths = TRUE,
boot_ages = TRUE,
al_var = TRUE,
al_var_ann = TRUE,
age_err = TRUE,
region = 'goa',
save = 'test')
Please see the R Documentation for description of the arguments used
in the surveyISS::srvy_iss()
function (including several
that aren’t defined in this example). While we set the number of
iterations here at 10 as a test, we recommend at least 500 iterations be
performed when running the surveyISS::srvy_iss()
function
to obtain ISS (this recommendation is based upon tests for when the ISS
stabilized across the replicates).
We note that there are several special cases that were developed
based upon the surveyISS::srvy_iss()
function; these
special cases include stock complex, spatially-explicit, and conditional
age-at-length cases. Please see the associated vignettes for examples of
using the surveyISS
package and description of the specific
output for these cases.
Step 6. Obtain and evaluate output.
For the standard surveyISS::srvy_iss()
example in
Step 5 (and for most special cases except condition
age-at-length) there will be two output files:
save
as in the surveyISS::srvy_iss()
run in
Step 5), and,These two files will be written to a subfolder within the
output
folder that is defined as whatever text string you
used to define the region
argument in the
surveyISS::srvy_iss()
run in Step 5 (similar to
how the queried data is saved, for this example for GOA Pacific cod the
output will be stored in the output\goa
folder).
The following is a description of the columns that are included in the age and length composition ISS output:
Column | Description |
---|---|
year | The year for which the ISS has been computed for the age/length composition data |
species_code | The RACE species code for you stock (e.g., 21720 for Pacific cod) |
sex | The sex category for which the age/length composition ISS has been computed. The following is a description for each numerical value: |
0 - combined sex age/length composition, where the length frequency and specimen data have been combined to a single sex prior to design-based expansion | |
1 - male age/length composition | |
2 - female age/length composition | |
12 - male-female age/length composition where the composition data sum to 1 across both sexes (rather than sum to one for each individual sex as for categories 1 or 2) | |
4 - combined sex age/length composition, where the age/length design-based population estimates are summed post-expansion and then age/length composition is computed (this has been the status quo for single-sex stock assessments) | |
sex_desc | Text string with short description of sex category |
iss | Input sample size |
nss | Nominal sample size (the number of lengths collected or ages read) |
nhls | The number of hauls from which samples were collected |
Within the surveyISS::srvy_iss()
there are two arguments
for additional output that can be created if you so desire (currently
default = FALSE, and thus aren’t included in the example provided in
Step 5).
The first is the save_interm
argument, which saves the
intermediate results. These include:
The second is the save_stats
argument, which saves
several statistics that could be of interest. These include:
gapindex
package.
In addition to the mean and SD in length-at-age computed without any
bootstrap resampling (which is the standard output provided in the
GAP_PRODUCTS.AKFIN_AGECOMP table) you are also provided the mean and SD
in length-at-age across the bootstrap replicates (which, if desired
would include ageing error and growth varaibility)Step 7. Filter the ISS to your desired sex category and implement within your stock assessment. Best of luck!