csa: Prepare an object for a CSA assessment to be used in...

Description Usage Arguments Details Value Examples

View source: R/csa.R

Description

Create list with a TMB framework, including data, gradients and NLL function for a CSA assessment that can be optimised.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
csa(
  catch_no,
  indices_no,
  indices_att,
  ts,
  selrec = 1,
  start_q = 1e-08,
  start_surveycv = 0.1,
  start_prec0,
  start_rec,
  start_nmort = 0.2,
  start_f_calc = 0.3,
  start_catchcv = 0.1,
  fix_nmort = TRUE,
  fix_prec0 = FALSE,
  fix_surveycv = FALSE,
  fix_catchcv = TRUE
)

Arguments

catch_no

numeric vector of catch numbers over time period of assessment

indices_no

matrix of survey indices (numbers) of dimensions: no. of indices x no.years

indices_att

matrix of survey indices attributes of dimensions: no. of indices x 2. First column defines survey and second column defines survey type (1 = recruit index, 2 post-recruit index, 3 = whole asessed population index). For example the minimum needed to run CSA is one survey split into a recruit index and a post-recruit index, the attribute matrix should look like:

survey type
1 1
1 2
ts

numeric. Survey timing parameters

selrec

matrix of selection proportions of the recruit indices (in comparison to the post-recruit index) if known. Dimensions: no. of recruit indices x no. years. Defaults to 1 for all years (i.e. no difference between recruit and post-recruit indices of a survey)

start_q

Starting values for survey catchability parameters. Default is 1e-6

start_surveycv

Starting values for survey cv parameters. Default is 0.1

start_prec0

Starting parameter value for post-recruit numbers at first time step. Default is 4*max(catch.no).

start_rec

Starting parameter values for estimated recruit numbers. Default is 2*max(catch.no).

start_nmort

Starting parameter value for natural mortality. Default is 0.2

start_f_calc

Starting parameter values for estimated fishing mortality. Default is 0.3.

start_catchcv

Starting parameter value for catch cv. Default is 0.1

fix_nmort

logical. Should natural mortality be fixed in the model

fix_prec0

logical. Should post-recruit numbers in the first time step be fixed in the model.

fix_surveycv

logical. Should survey CV be fixed in the model.

fix_catchcv

logical. Should catch CV be fixed in the model.

Details

csa is simply a wrapper function that gives the output from MakeADFun from TMB, i.e. an objective function with derivatives, hessian etc. Otimisation and extraction of values from the assessment models has been kept separate to allow flexibility with optimisation methods as well as easy access to MakeADFun outputs such as the hessian, gradients etc. See http://kaskr.github.io/adcomp/_book/Introduction.html and TMB documentation for details. Users should refer to the sbar vignette by running vignette("intro_to_sbar", "sbar") for details on the csa function.

The table below gives the outputs and description of the values that can be extracted from this assessment model after optimisation and summary(TMB::sdreport(x)) of the csa object.

Output Description
logitqhat logit transformed survey catchability
logphat1 log transformed post-rec numbers at first time step
logrhat log transformed recruitment numbers
logf_calc log transformed fishing mortality
log_surveycv log transformed survey CV
log_catchcv log transformed catch CV
lognmort log transformed natural mortality
phat post-recruit numbers
rhat recruit numbers
bhat total numbers
lnphat log transformed post-rec numbers
lnbhat log transformed total numbers
lnc log transformed catch numbers
c_calc catch numbers
logpred_survey log transformed predicted survey indices
sdsurv Survey index standard deviation
f_calc fishing mortality
phat1 post-rec numbers at first time step
nmort natural mortality
qhat survey catchability

Value

List with components for optimiser in R. This output is that of the function MakeADFun from TMB

Access (transformed) starting values of parameters to be estimated with x$par (where x is the csa object) to see what parameters are to be estimated.

Examples

1
2
3
## Not run:  obj <- csa(catch_n = catch.no, indices_no = obs,
indices_att = indices_att, ts = #'timing, #'start_nmort = nm)
## End(Not run)

lbatts/sbar documentation built on Feb. 25, 2022, 9:02 a.m.