S4 class that organizes the various data inputs for the MSA model. MSAdata simply inherits the slots from 6 component classes:
Dmodel, Dstock, Dfishery, Dsurvey DCKMR, and Dtag, where the D- prefix denotes an object for data inputs (or model configuration).
Details
For convenience, most arrays and matrices have the associated dimensions in the variable name. For example, Cobs_ymfr represents
observed catch with the dimension following the underscore, following this template:
y | Year |
m | Season |
a | Age |
r | Region |
f | Fishery |
i | Index |
s | Stock |
Slots
DmodelClass Dmodel containing parameters for model structure (number of years, ages, etc.)
DstockClass Dstock containing stock parameters (growth, natural mortality, etc.)
DfisheryClass Dfishery containing fishery data (catch, size and stock composition, etc.)
DsurveyClass Dsurvey containing survey data (indices of abundance)
DCKMRClass DCKMR containing genetic close-kin data
DtagClass Dtag containing tagging data
DlabelClass Dlabel containing names for various dimensions. Used for plotting.
MiscList for miscellaneous inputs as needed
Slots inherited from Dmodel
nyInteger, number of years
nmInteger, number of seasons
naInteger, number of ages. The first age class is zero and the last age class (plus group is age
na - 1).nlInteger, number of length bins. Set to zero if lengths are not modeled.
nrInteger, number of spatial regions
nsInteger, number of stocks
lbinVector of lower boundary of length bins. Length
nl + 1lmidVector of midpoint of length bins. Length
nlFmaxNumeric, maximum allowable instantaneous fishing mortality rate (units of per season). Defaults to 3.
y_phiInteger, the year from which to obtain values of natural mortality and fecundity for the unfished stock-recruit replacement line (
phi). Relevant if natural mortality or fecundity are time-varying. Defaults to 1.scale_sVector, length
ns. Multiplicative scaling factor that informs relative stock size to aid parameter estimation. Larger values implies larger stocks. Default set to 1. Seemake_parameters().nyinitInteger, number of years of spool-up to calculate equilibrium unfished and starting conditions for the population model to account for seasonal and spatial dynamics. The numerical spool-up is not needed when both
nm = 1andnr = 1, i.e.,nyinit = 1. Otherwise, set to2 * naby default.conditionCharacter, either to specify the model estimates fishing mortality as a parameter (
"F", default) or equal to the catch ("catch").nitFInteger, number of iterations to solve Baranov catch equation from observed catch if
condition = "catch". Defaults to 5.y_Fmult_fInteger vector by fleet, the year in which to directly estimate F. Choose a year/season/region combination when the catch is average relative to the time series. Only used if
condition = "F".m_Fmult_fInteger vector by fleet, the season in which to directly estimate F. Choose a year/season/region combination when the catch is average relative to the time series. Only used if
condition = "F".r_Fmult_fInteger vector by fleet, the region in which to directly estimate F. Choose a year/season/region combination when the catch is average relative to the time series. Only used if
condition = "F".pbc_rdev_ysNumeric matrix, for the fraction of lognormal bias correction (
-0.5 * sd_r^2) applied to the recruitment estimates in the model. Typically between 0-1, with default of 1.pbc_initrdev_asNumeric matrix, for the fraction of lognormal bias correction (
-0.5 * sd_r^2) applied to the initial abundance vector in the model. Typically between 0-1, with default of 1.priorCharacter vector to be evaluated in the model to return the log prior for a parameter. See example in documentation for prior.
nyretInteger, number of recent years of data to remove from the likelihood for retrospective analysis (positive numbers). Default is zero.
Slots inherited from Dstock
m_spawnInteger, season of spawning. Defaults to 1. The progeny will enter the age structure in the same season.
m_advanceageInteger, season in which to advance age classes (corresponding to calendar year) to the next age class. Defaults to 1.
len_ymasLength-at-age. Only needed if
Dmodel@nl > 0to fit length composition (you may want to calculate the growth at the middle of the time step).calc_growth()may be a helpful function.sdlen_ymasStandard deviation in length-at-age
LAK_ymalsLength-at-age probability array. If empty, values will be calculated by
check_data()withcalc_LAK().mat_yasProportion mature by age class. Ignored if maturity ogive is estimated, e.g., when fitting to close-kin genetic data.
swt_ymasStock weight-at-age (at beginning of time step). See
calc_growth()example.fec_yasFecundity, i.e., spawning output, of mature animals. Default uses stock weight at age.
M_yasNatural mortality. Instantaneous units per year. Ignored if M is estimated.
SRR_sCharacter vector of stock-recruit relationship by stock. See
SRRargument incalc_recruitment()for options.delta_sFraction of season that elapses when spawning occurs, e.g., midseason spawning occurs when
delta_s = 0.5. Default is zero.presence_rsLogical matrix indicating presence/absence of stock
sin regionr. Used to constrain movement matrix. Default is TRUE for all stocks and regions.natal_rsThe fraction of the mature stock
sin regionrthat spawns at time of spawning. See example. Default is 1 for all stocks and regions.
Slots inherited from Dfishery
nfInteger, number of fleets
Cobs_ymfrTotal fishery catch
Csd_ymfrLognormal standard deviation of the fishery catch. Only used if
Dmodel@condition = "F". Default of 0.01.fwt_ymafsFishery weight at age. Set to 1 when fleet catch is in units of abundance. Set to stock weight at age by default (values at beginning of time step).
CAAobs_ymafrFishery catch at age composition
CALobs_ymlfrFishery catch at length composition
fcomp_likeCharacter, likelihood for the fishery composition data. See
typeargument oflike_comp()for optionsCAAN_ymfrSample size of the catch at age vector by season if using the multinomial or Dirichlet-multinomial likelihoods
CALN_ymfrSample size of the catch at length vector by season if using the multinomial or Dirichlet-multinomial likelihoods
CAAtheta_fCatch at age dispersion parameter if using the Dirichlet-multinomial likelihood. Default set to 1.
CALtheta_fCatch at length dispersion parameter if using the Dirichlet-multinomial likelihood. Default set to 1.
sel_block_yfIndex of dummy fleets to model time blocks of selectivity
sel_fCharacter vector of the functional form for selectivity. Choose between:
"logistic_length", "dome_length", "logistic_age", "dome_age", "SB", "B"Cinit_mfrEquilibrium seasonal catch prior to the first year. One way to initialize the abundance at the start of the first year in the model. Default of zero.
SC_ymafrsStock composition data.
SC_aaBoolean matrix that aggregates age classes for the stock composition data. See example.
SC_ffBoolean matrix that aggregates fleets for the stock composition data. See example.
SC_likeCharacter, likelihood for the stock composition data. See
typeargument oflike_comp()for optionsSCN_ymafrSample size of the stock composition vector if using the multinomial or Dirichlet-multinomial likelihoods
SCtheta_fStock composition dispersion parameter if using the Dirichlet-multinomial likelihood. Default set to 1.
SCstdev_ymafrsStock composition standard deviation if using the lognormal likelihood. Default set to 0.1.
Slots inherited from Dsurvey
niInteger, number of indices of abundance. Zero is possible.
Iobs_ymiObserved indices
Isd_ymiLognormal standard deviation of the observed indices
unit_iCharacter vector, units of the index. Set to
"B"to use stock weight at age (default) or"N"for abundance (numbers).IAAobs_ymaiArray, survey age composition
IALobs_ymliArray, survey length composition
icomp_likeCharacter, likelihood for the composition data. See
like_comp()for optionsIAAN_ymiArray, sample size of the index age composition by season if using the multinomial or Dirichlet-multinomial likelihoods
IALN_ymiArray, sample size of the index length composition by season if using the multinomial or Dirichlet-multinomial likelihoods
IAAtheta_iNumeric vector, survey age composition dispersion parameter if using the Dirichlet-multinomial likelihood
IALtheta_iNumeric vector, index length composition dispersion parameter if using the Dirichlet-multinomial likelihood
samp_irsBoolean array that specifies the regions and stocks sampled by the index.
samp[i, r, s]indicates whether indexioperates in regionrand catches stocks.sel_iCharacter vector, functional forms for selectivity. See
"type"argument inconv_selpar()for options.delta_iNumeric vector, The elapsed fraction of time in the seasonal time step (between 0 - 1) when the index samples the population. Set to a negative number (-1) to sample over the duration of the timestep, i.e.,
(1 - exp(-Z))/Z.
Slots inherited from DCKMR
POP_sA list by stock of data frames for parent-offspring pairs. Each row in the data frame corresponds to a "sampling unit" defined by the columns:
aCapture year of parent tAge at capture of parent yBirth year of offspring nNumber of pairwise comparisons mNumber of POPs HSP_sA list by stock of data frames for half-sibling pairs. Each row in the data frame corresponds to a "sampling unit" defined by the columns:
yiBirth year of older sibling yjBirth year of younger sibling nNumber of pairwise comparisons mNumber of HSPs CKMR_likeCharacter, likelihood for the POP and HSP sampling units. See
typeargument inlike_CKMR()for options.
Slots inherited from Dtag
tag_ymarrsArray. Number of tags that move between regions. Informs movement matrices of stocks between time steps.
tag_ymarsArray. Number of tags distributed among regions. Informs stock distribution (within time step).
tag_yyBoolean matrix that aggregates years for the tag data. Only used for the tag movement array
tag_ymarrs.tag_aaBoolean matrix that aggregates ages for the tag data.
tag_likeCharacter. Likelihood for the tagging data, either the vector of proportions by region of origin for
tag_ymarrs, or by region of stock distribution fortag_ymars. Seetypeargument oflike_comp()for optionstagN_ymarsArray. Sample size of the tag movement vectors if using the multinomial or Dirichlet-multinomial likelihoods.
tagN_ymasArray. Sample size of the tag distribution vectors if using the multinomial or Dirichlet-multinomial likelihoods.
tagtheta_sArray. Tag dispersion parameter (by stock) if using the Dirichlet-multinomial likelihoods. Default set to 1.
tagstdev_sArray. Tag standard deviation (by stock) if using the lognormal likelihood. Default set to 0.1.
Slots inherited from Dlabel
yearVector of years. Length
Dmodel@nyseasonVector of season names. Length
Dmodel@nmageVector of ages. Length
Dmodel@naregionVector of region names. Length
Dmodel@nrstockVector of stock names. Length
Dmodel@nsfleetVector of fleet names. Length
Dfishery@nfindexVector of index of abundance names. Length
Dsurvey@ni
Examples
# Set natal_rs matrix so that the spawning output of stock 1 is
# calculated from mature animals present in regions 1, 2.
# Similarly for stock 2, spawning output from areas 2 and 3.
nr <- 4
ns <- 2
natal_rs <- matrix(0, nr, ns)
natal_rs[1:2, 1] <- natal_rs[2:3, 2] <- 1
# Aggregate stock composition for ages 1-4 and 5-10 across all fleets
na <- 10
na_SC <- 2
SC_aa <- matrix(0, na_SC, na) # Assumes dim(SC_ymafrs)[3] = na_SC
SC_aa[1, 1:4] <- SC_aa[2, 5:10] <- 1
nf <- 3
nf_SC <- 1
SC_ff <- matrix(1, nf_SC, nf) # Assumes dim(SC_ymafrs)[4] <- nf_SC