-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tex
6300 lines (4955 loc) · 315 KB
/
main.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass{article}
\usepackage{fullpage}
%\renewcommand{\familydefault}{\sfdefault}
%\usepackage[scaled=1]{helvet}
%\usepackage[helvet]{sfmath}
%\everymath={\sf}
\usepackage{hyperref}
\usepackage{parskip}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{graphicx}
\usepackage{bbm}
\usepackage{mathrsfs}
\usepackage{lineno}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{hyperref}
\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered
\titleformat{\subsubsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
%\def\toclevel@paragraph{6}
\def\toclevel@subparagraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{7em}{4em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\makeatother
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
%\linenumbers
%\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{algorithm,algcompatible,amsmath}
\usepackage[backend=biber]{biblatex}
\bibliography{referencias.bib}
\title{The Joint Jack Mackerel (JJM) model: A user guide
\ \\[3mm]
{Edition: 01}\\
{Revision: 00}\\
\ \\[0.5mm]}
\date{\parbox{\linewidth}{\centering%
\skip
Mirian GERONIMO \hspace*{0.8cm} Criscely LUJAN \hspace*{0.8cm} Josymar TORREJON \hspace*{0.8cm} Elmer QUISPE \endgraf\medskip
Instituto del Mar del Perú (IMARPE)}
}
%\setcounter{tocdepth}{2}
\setcounter{tocdepth}{3}
\begin{document}
% \begin{titlepage}
% \begin{center}
% {“Año del Bicentenario, de la consolidación de nuestra Independencia, y de la conmemoración de las heroicas batallas de Junín y Ayacucho”}\\
% \ \\[6mm]
% {\bf \Large Instituto del Mar del Perú}\\
% \ \\[1mm]
% {\bf \Large (IMARPE)}\\
% \ \\[1mm]
% \includegraphics[scale=0.3]{WhatsApp Image 2024-07-05 at 4.08.37 PM.jpeg}\\
% \ \\[5mm]
% {\textbf{\huge The Joint Jack Mackerel (JJM) model: A user guide}
% \ \\[3mm]
% {\bf Edition: 01}\\
% {\bf Revision: 00}\\
% \ \\[0.5mm]}
% \end{center}
% {\ \ \ \ \ Mirian GERONIMO \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Criscely LUJAN \ \ \ \ \ \ \ \ \ \ \ \ \ \ Josymar TORREJON \ \ \ \ \ \ \ \ \ \ \ \ \ \ Elmer QUISPE}\\
% \end{titlepage}
%\maketitle
\begin{center}
\ \\[5mm]
{\textbf{\Large The Joint Jack Mackerel (JJM) model: A user guide \\
Imarpe's proposal}
\ \\[3mm]
{\bf Edition: 01}\\
\ \\[0.5mm]}
{Mirian GERONIMO$^{1}$, Criscely LUJAN$^{1}$, Josymar TORREJÓN$^{1}$, Elmer QUISPE$^{1}$}\\
\small{$^{1}$Instituto del Mar del Perú (IMARPE)}
\end{center}
\begin{center}
\section*{Abstract}
\end{center}
% This document is intended to serve as a user's guide for those interested in learning about the JJM model internally and how to use it. Therefore, it focuses on the description of the mathematical equations of the population dynamics of Jack Mackerel, and computational aspects such as software installation (AD Model Builder), input and output files, model run, and %finally a case study that serves as an example of the use of the JJM model. Finally, it is worth mentioning that this document is born as a proposal of Imarpe as a contribution to the understanding of the internal aspects of the model.
% a case study illustrating the practical application of the JJM model. Finally, it is important to mention that this document was created by Imarpe as a proposal to enhance the understanding of the model's internal aspects.
This document is intended to serve as a user's guide for those interested in learning about the JJM model internally and how to use it. Therefore, it focuses on the description of the mathematical equations of the population dynamics of Jack Mackerel, and computational aspects such as software installation (AD Model Builder), input and output files, model run, and a case study illustrating the practical application of the JJM model. Finally, it is important to mention that this document was created by Imarpe as a proposal to enhance the understanding of the model's internal aspects and that it is open to collaborations for future versions.
\newpage
\tableofcontents
\newpage
%\section*{Abstract}
\section{Introduction}
This document provides a concise overview of the model, including its history and the primary assumptions regarding its structure. It will also cover the algebraic specifications of the assessment model, detailing the mathematical equations used to simulate the population dynamics of Jack mackerel and the functions defined in the model code to obtain key quantities such as the maximum sustainable yield (MSY), biological reference points (BRPs), and catch projections.
% For this purpose, we have analyzed the model code located at %\href{https://github.com/CriscelyLP/jjm/blob/main/src/jjm.tpl}{this repository}
% \href{https://github.com/SPRFMO/jjm/blob/main/src/jjm.tpl}{in the SPRFMO repository} and explain how the input data (data and control files) is used internally in the model, and which parameters are estimated. Furthermore, the main steps for installing JJM and model running are presented.
To achieve this, the model code found \href{https://github.com/SPRFMO/jjm/blob/main/src/jjm.tpl}{in the SPRFMO repository} has been reviewed and clarified regarding how the input data (data and control files) are used within the model, as well as what parameters are being estimated. In addition, a description of the main steps to install the JJM and run the model has been provided.
The main sections are (i) the JJM model features, (ii) the mathematical model details which describe the equations to simulate the population dynamics, (iii) the likelihood components and the objective function to be maximized, (iv) the model parameters to analyze the process of parameters optimization, and (v) the file organization which contains the input and output files of the JJM model.
Finally, a data set is provided and used as part of a case study (see \nameref{section:AppendixA}). This information is used as input to simulate an assessment (see results in \nameref{section:AppendixB}).
Part of the concepts of the JJM model presented here come from \href{https://www.sprfmo.int/assets/Meetings/SC/10th-SC-2022/Report-and-Annexes/Annex-8-JM-Technical-Advice-CV_2.pdf}{SPRFMO SC10 Report-Annex 10- Jack Mackerel Technical Annex}. This document is intended to provide an illustrative description of the JJM model that can support and guide current or potential users.
\section{Joint Jack Mackerel (JJM) model}
% The JJM is a statistical catch-at-age and age-structured model used to evaluate the Jack mackerel (\textit{Trachurus murphyi}). This species is widespread throughout the South Pacific Ocean. There are at least five management units identified of Jack mackerel which are associated with distinct fisheries: the Ecuadorian and Peruvian fishery, the northern and central-southern Chilean fisheries, and the purely high sea fishery \cite{sc10report}.
The JJM is a statistical catch-at-age and age-structured model used to evaluate the Jack Mackerel (\textit{Trachurus murphyi}). This species is widespread throughout the South Pacific Ocean. There are at least five management units identified for Jack mackerel, each associated with distinct fisheries: the Ecuadorian and Peruvian fishery, the northern and central-southern Chilean fisheries, and the purely high-sea fishery \cite{sc10report}.
% In the South Pacific Regional Fisheries Management Organisation (SPRFMO), the JJM model was adopted as the assessment model in 2010. In this context, every year an update of the model data is carried out, to then run the model using updated data inputs and indices. Model results are used to provide a recommendation of the Jack Mackerel population status for its exploitation. Besides, the JJM model has also been adopted for SPRFMO delegations, for example, the Peruvian delegation use the same model for the Jack mackerel assessment on Peruvian national jurisdictional waters.
The JJM model was adopted as the assessment model in the South Pacific Regional Fisheries Management Organisation (SPRFMO) in 2010. Each year, the model data is updated, and then the model is run using the updated data inputs and indices. The results of the model are used to recommend the status of the Jack Mackerel population for its exploitation. Additionally, the JJM model has been adopted by SPRFMO delegations, such as the Peruvian delegation, which uses the same model to assess the Jack mackerel in Peruvian national jurisdictional waters.
The JJM model, implemented in AD Molder Builder (\href{https://www.admb-project.org/}{ADMB}), uses a forward projection approach and maximum likelihood estimation to solve for model parameters. The operational population dynamics model of the JJM is defined by the standard catch equation with various modifications such as those described by Fournier \& Archibald (1982)\cite{fournier-1982}, Hilborn \& Walters (1992) \cite{Hilborn1992} and Schnute \& Richards (1995)\cite{schnute-1995}.\\
% There are three important sections in the JJM model template\cite{admbmanual}:
% \begin{itemize}
% \item The data section describes the data structure in the model. Some data is read from a file, these data are declared in the data section with the \textbf{init} prefix,
% \item The parameter section describes the model parameterization,
% \item The procedure section describes the current model calculations.
% \end{itemize}
\subsection{Model history}
% Since its adoption as assessment method (2010), the JJM model has been in continuous development and has been improved by participant scientists mainly involved in the SPRFMO. The most important changes %since its creation
% were related to: i) the inclusion of length composition data (and specifying or estimating growth), ii) the estimation of natural mortality by age and time, iii) the consideration of two stock hypotheses in one run execution.
Since its adoption as an assessment method in 2010, the JJM model has undergone continuous development and improvement by scientists participating in the SPRFMO. The most important changes include: (i) the inclusion of length composition data and the specification or estimation of growth, (ii) the estimation of natural mortality by age and time, and (iii) the consideration of two stock hypotheses in one run execution.
Nowadays, the model allows the use of catch information either at age or size for any fleet. This is an important change that provides flexibility in data usage. Besides, another important change is the explicit incorporation of regime shifts. %in population productivity.
The model consists of four main components: i) the dynamics of the stock, ii) the fishery dynamics, iii) the observation models for data, and iv) the procedure used for parameter estimation (including uncertainties).
\subsection{Main assumptions}
A statistical catch-at-age model analyzes data on the age of fish caught in scientific surveys and by fisheries to provide management advice. Catch-at-age models typically require information on %stock
age, fishing effort, and total catches for each fishery targeting a stock.
% To apply a statistical catch-at-age model, specific data as observed catch for fishery and index survey, weigth-at-age for fisheries and index surveys, population weigth for each stock and maturity are needed for each age class, where an age class is a set of all fish with the same age
%born in a given year
In order to use a statistical catch-at-age model, we need data on the observed catch from the fishery and index surveys, as well as weight-at-age information for both fisheries and index surveys. Additionally, population weight for each stock and maturity data are required for each age class, where an age class encompasses all fish of the same age.\\
Catch-at-age results provide comprehensive management advice by estimating a stock's current size and the management reference points (e.g. maximum sustainable yield (MSY)). The main assumptions of these models, implemented in the JJM model, are detailed in the following sections.
\subsubsection{Stock dynamics}
\begin{itemize}
\item The JJM model is not spatially-explicit, although the fisheries operate in geographically distinct areas.
\item The model needs initial conditions that should preferably be set at equilibrium conditions.
\item The population's age composition considers individuals of different ages (from 1 to more). But in all cases, a stochastic Beverton-Holt relationship is included.
\item The recruitment and the spawning season should be assumed to occur in a specific time.
\item The source of mortality is age-specific and composed of fishing mortality at age by fleet and natural mortality. %Currently, natural mortality is assumed to be constant over time and age.
Currently, in the SPRFMO assessment, natural mortality is assumed to be constant over time and age but in the JJM model it is flexible to variability and even estimation.
\end{itemize}
\subsubsection{Fishery dynamics}
\begin{itemize}
\item The JJM model assumes that the interaction of the population with the fishery occurs through fishing mortality.
\item The fishing mortality is assumed to be a composite of several processes: selectivity by fleet, catchability, and effort deviations.
\item The selectivity reports the age-specific pattern of fishing mortality. The pattern is non-parametric and is assumed to be fishery-specific and time-variant.
\item The catchability describes effort scales to fishing mortality. The catchability is specific to each abundance index.
\item The effort deviations describe a random effect in the fishing effort.
\item The JJM model includes temporal variation in both fishery and index selectivity patterns at the annual and regime scales, depending on the index and the stock structure hypothesis.
\end{itemize}
\subsubsection{Observation models for data}
\begin{itemize}
\item Four data components contribute to the log-likelihood function: the total catch data, the age-frequency data, the length-frequency data, and the abundance indices.
\item Probability distributions for the age and length-frequency proportions are assumed to be approximated by multinomial distributions.
%\item Sample size is specified to be gear-specific but mostly constant over the years.
\item Sample size is specified to be gear-specific but mostly constant over the years in the SPRFMO assessment, however, in the JJM model is flexible to variability over time.
\item For the total catch by fishery and the abundance indices, a log-normal assumption has been assumed with a constant coefficient of variation (CV).
\end{itemize}
\subsubsection{Parameter estimation}
\begin{itemize}
\item The most numerous parameters estimated involve estimates of annual and age-specific components of fishing mortality for each year and each of the four fisheries identified in the model.
\item Model parameters are estimated by maximizing the log-likelihoods of the data plus the log of the probability density functions of the priors and smoothing penalties specified in the model.
\item Parameter estimation is conducted in a series of phases, the first of which uses arbitrary starting values for most parameters.
\end{itemize}
\section{Mathematical Model details}
\subsection{Population Dynamics}
This catch-at-age model is used as the underlying assessment model able to fit the CPUE indices and the catch-at-age and length data. The assessment process involves developing a model of the resource dynamics and conditioning its output to the available data by maximizing the log-likelihood function or equivalently by minimizing the negative of the log-likelihood function.
\subsubsection{a. Numbers at age} \label{N}
The population dynamics are modeled following this set of equations:
\begin{equation}
N^s_{y,a=1}=e^{\mu_{R,y}^s+\epsilon_{y}^s} \ \ \ \ \ , y_{1}\leq y \leq y_{N}
\end{equation}
where:
\begin{itemize}
\item $N^s_{y,a=1}$ is the numbers of fish of group age \textit{a=1} and stock \textit{s} in year \textit{y};
%\item the simulation period ${y \in \{y_{0}, y_1, y_2,..., y_{N}\}}$;
\item \textit{s} is a fish stock with $1\leq s \leq n_{stk}$, where $n_{stk}$ is the total number of simulated stocks;
%\item \textit{a} the group age and \textit{y} the year;
\item $\mu_{R,y}^s$ is the mean of the logarithm of recruitment;
%\item $\mu_R$: $mean\_log\_rec(cum\_regs(s)+yy\_sr(s,y))$;
\item $\epsilon_{y}^s$ is the annual deviation of recruitment.
%\item $\epsilon_{y}:rec\_dev(s,y)$;
\end{itemize}
The JJM has two options to calculate the numbers at age, the first is using the Popes approximation, a variant of the statistical catch-at-age, and the second is without it. For the first case,
%the model fixes the predicted catches to the observed catches using Pope's approximation to calculate the annual exploitation rate in the midpoint of the year. In this case:
\begin{equation}
N^{s}_{y+1,a+1}=N^s_{y,a}e^{-M^s_y}-C^s_{y,a}e^{-M^s_y*0.5}, \ \ \ \ \ 1\leq a \leq m-2,
\end{equation}
\begin{equation}
N^s_{y+1,a=m}=N^s_{y,m-1}e^{-M^s_y}-C^s_{y,m-1}e^{-M^s_y 0.5}+N^s_{y,m}e^{-M^s_y}-C^s_{y,m}e^{-M^s_y 0.5},
\end{equation}
where $y_1\leq y \leq y_N+1$ and:
\begin{itemize}
%\item $\ y_1\leq y \leq y_N+1$
\item $m$ is the number of ages, inside the model it is calculated as $m=o_a-r_a+1$ where $r_a$ is the age at recruitment and $o_a$ is the oldest age;
\item $N^{s}_{y+1,a+1}$ is the number of fish at age $a+1$ for the stock $s$ in the year $y+1$;
\item $N^{s}_{y+1,m}$ is the number of fish at age $m$ for the stock $s$ in the year $y+1$;
\item $M^{s}_{y}$ denotes the natural mortality rate on fish of stock $s$ in the year $y$;
\item $C^s_{y,a}$ and $C^s_{y,m}$ denotes the total catch of stock $s$ in the year $y$ at age $a$ and $m$ respectively (see c. Catches).
\end{itemize}
\hfill
In addition, the fishing mortalities and survival rate are calculated:
\begin{equation} \label{eq: fs}
F^s_{y,a}=log\left(\dfrac{N^s_{y,a}}{N^s_{y+1,a+1}}\right)-M^s_y, \ \ \ \ \ 1\leq a \leq m-1
\end{equation}
\begin{equation}
F^s_{y,m}=log\left(\dfrac{N^s_{y,m-1}+N^s_{y,m}}{N^s_{y+1,m}}\right)-M^s_y
\end{equation}
where:
\begin{itemize}
\item $F^s_{y,a}$ is the fishing mortality for the stock \textit{s} at the age \textit{a} in the year \textit{y};
\item $F^s_{y,m}$ is the fishing mortality for the stock \textit{s} at the maximum age \textit{m} considered in the year \textit{y}.
\end{itemize}
\hfill
Also, the fishing mortality for each fishery and the survival rate are calculated as follows:
\begin{equation}
F^k_{y,a}=F^s_{y,a}\dfrac{\sum_{a = 1} ^{m} Cat^k_{y,a}}{\sum_{a=1} ^{m} C^s_{y,a}}, \ \ \ \ \ 1\leq a \leq m.
\end{equation}
% \begin{equation}
% S^s_{y,a}=e^{-(F^s_{y,a}+M^s_{y})}
% \end{equation}
where:
\begin{itemize}
\item $k$ denotes the fishery number and $s$ is the corresponding stock due to the fishery;
\item $1\leq k \leq n_{fsh}$ where $n_{fsh}$ is the total number of fisheries;
\item $F^k_{y,a}$ is the fishing mortality for fishery $k$ at age $a$ in the year $y$;
\item $Cat^k_{y,a}$ is the catch at age $a$ for fishery $k$ in the year $y$ (see section c. Catches \ref{ch: catches});
%\item $S^s_{y,a}$ is the survival rate for the stock $s$ at age $a$ in the year $y$.
\end{itemize}
\hfill
For the second case, when the Pope approximation is not used, the number at age and survival rate are calculated as follows:
\begin{equation}
N^s_{y+1,a+1}=N^s_{y,a}S^s_{y,a}, \ \ \ \ \ 1\leq a \leq m-2
\end{equation}
\begin{equation}
N^s_{y+1,m}=N^s_{y,m-1}S^s_{y,m-1}+N^s_{y,m}S^s_{y,m}, \ \ \ \ a = m
\end{equation}
with $\ y_1\leq y \leq y_N+1$.\\
Defining the fishing mortality for the stock, and the fishing mortality for the fishery, respectively, as:
\begin{equation} \label{eq: fs2}
F^s_{y,a} = \sum_{k_s}F^{k_s}_{y,a},
\end{equation}
where the sum is over all fisheries $k_s$ belonging to stock s;
% \begin{equation}
% S^s_{y,a}=e^{-(F^s_{y,a}+M^{s}_{y})},
% \end{equation}
\begin{equation}
F^k_{y,a}=e^{fmort^k_y}Se^k_{y,a}, \ \ \ y_0\leq y \leq y_N \ \ \ and \ \ \ 1\leq a \leq m
\end{equation}
where:
\begin{itemize}
\item $fmort^k_y$ is the annual mortality for the fishery $k$ in the year $y$, it is a parameter to be estimated;
\item $Se^k_{y,a}$ is the fishing selectivity for the fishery $k$ in the year $y$ at the age $a$.
\end{itemize}
\hfill
With Popes approximation and without Popes approximation the survival rate for the stock $s$ at age $a$ in the year $y$ is calculated as:
\begin{equation}
S^s_{y,a}=e^{-(F^s_{y,a}+M^s_{y})}.
\end{equation}
Also in both cases (i.e. with or without Popes approximation), the numbers at age for the year $y_0$, stock $s$, and age $a$ are calculated as follows:
\begin{equation}
N^s_{y_0,a=1}=e^{\mu^s_{R,y_0} + \epsilon^s_{y_0}},
\end{equation}
for all other ages, let $r_0 := y_0-m+r_a$ the first year of recruitment and $r_a$ the recruitment age. If $r_a=1$, then:
\begin{equation}
N^s_{y_0,a}=e^{\mu_{R,y_0-a+1}^s + \epsilon^s_{y_0-a+1}}
\prod_{j=1}^{a-1}e^{-M^s_{y_0,j}}, \ 1<a<m.
\end{equation}
%M^s=_{y_0,j}=M^s_{y_0}, ya que la mortalidad natural es constante
Otherwise if $r_a>1$:
\begin{equation}
N^s_{y_0,a}=e^{\mu_{R,y_0-a+1}^s + \epsilon^s_{y_0-a+1}} \prod_{j=1}^{a-1}e^{-M^s_{y_0,j}}, \ 1<a\leq m-r_a+1,
\end{equation}
\begin{equation}
N^s_{y_0,a}=R_0^{s,1}\prod_{j=1}^{a-1}e^{-M^s_{y_0,j}}, \ m-r_a+1<a\leq m-1
\end{equation}
where $R_0^{s,1}$ is the recruitment for the first regime of stock $s$.
Finally, the number at age for the maximum age (i.e. $m$) considered in the population is:
\begin{equation}
N^s_{y_0,m}=N^s_{y_0-1,m-1}e^{-M^s_{y_0,m-1}}+N^s_{y_0-1,m}e^{-M^s_{y_0,m}}.
\end{equation}
\hfill
\hfill
\subsubsection{b. Spawning stock biomass} \label{ssb}
The spawning stock biomass ($SSB$) is the total biomass of fish of reproductive age during the breeding season of a stock. $SSB$ is calculated from the first year of spawning denoted by $ssb_0$ until year $y_N+1$ as follows:
\begin{equation}
SSB^s_y=wt\_{mat}^s_1 e^{-M^s_{y_0,1}s_f} R^s_0 +
\sum_{a=2}^{m-1}wt\_{mat}^s_a e^{-M^s_{y_0,a}s_f} R^s_0\prod_{l=1}^{a-1}e^{-M^s_{y_0,l}}
\end{equation}
\begin{equation*}
+
{wt\_mat}^s_{m} e^{-M^s_{y_0,m}s_f} \dfrac{R^s_0}{1-e^{-M^s_{y_0,m}}}\prod_{l=1}^{m-1}e^{-M^s_{y_0,l}}
\end{equation*}
where:
\begin{itemize}
\item $SSB^s_y$ is the spawning stock biomass for the stock $s$ in the year $y$, when $ssb_0\leq y \leq r_0$;
\item $ssb_0$ is calculated inside the model as $ssb_0 = r_0 - r_a + 1$;
\item $r_0$ is the first year of recruitment;
\item $r_a$ is the recruitment age;
\item $wt\_{mat}^s_a$ is the proportion of mature females (in weight) at each age $a$ in each stock $s$ this is calculated as a product of the population weight at age ($wt\_pop^s_a$) and the maturity ($maturity^s_a$) as follows:
\begin{equation}
wt\_{mat}^s_a=wt\_pop^s_a .maturity^s_a, \ \ \ 1\leq a \leq m
\end{equation}
\item $M^s_{y_0,m}$ is the natural mortality for stock $s$ at age $m$ in the year $y_0$;
\item $R^s_{0}$ is the is the recruitment to the first regime of stock s;
% \item spmo\_frac exponent of the survival rate ($S^s_{i,j}$), is computed as
% $spmo\_frac=\dfrac{spawnmo-1}{12}$.
\item $s_f$ is computed as $s_f=\dfrac{s_p-1}{12}$, where $s_p$ is the spawning month.
%\item spawnmo is input of file .dat, line 278.
\item according to the equation (\ref{eq: b01}), $SSB^s_y$ is equal to virgin biomass $B^{s,1}_0$ for the years $ssb_0\leq y \leq r_0$.
\end{itemize}
\hfill
Also, the $SSB$ is calculated for the years $r_0+1 \leq y \leq y_0 - 1$ and when $1\leq i \leq y_0-r_0$. First, the $nat_{age}$ is calculated as follows:\\
\begin{equation}
{nat_{age}}_{y=r_0+i,a}^s= e^{\epsilon^s_{r_0+i+1-a}+\mu^s_{R,r_0+i+1-a}}\prod_{t=1}^{a-1}e^{-M^s_{y_0,t}}, %\ \ and \
\ 2\leq a \leq i+1;
\end{equation}
\begin{equation}
{nat_{age}}_{y=r_0+i,a}^s=R^s_0\prod_{t=1}^{a-1}e^{-M^s_{y_0,t}}, \ \ i+2\leq a \leq m-1
\end{equation}
\begin{equation}
{nat_{age}}_{y=r_0+i,m}^s={nat_{age}}_{r_0+i-1,m-1}^s
+{nat_{age}}_{r_0+i-1,m}^s e^{-M^s_{m}}, \ \ a=m
\end{equation}
With these previous calculations, the $SSB$ is obtained:
\begin{equation}
SSB^s_y=\sum_{a=2}^{m}{nat_{age}}_{y,a}^s e^{-M^s_{y_0}s_f} wt\_{mat}^s_a, \ \ r_0 + 1 \leq y \leq y_0 - 1.
\end{equation}
Furthermore, after having calculated the numbers at age for each year and the survival rate (both depending on the choice of Popes, if it is true or false), the $SSB$ is calculated for the stock $s$ in the year $y$ with $y_0 \leq y \leq y_N$:
\begin{equation} \label{eq: ssb}
SSB^s_y=\sum_{a=1}^{m}N^s_{y,a}{(S^s_{y,a})}^{s_f}{wt\_{mat}}^s_a, \ \ y_0 \leq y \leq y_N.
\end{equation}
% \begin{itemize}
% \item $wt\_pop^s_j$: es input, línea 140 del ctl. Peso a la edad $j$ de la población para cada stock $s$.
% \item $maturity^s_j:$ es input, línea 143 del ctl. Madurez a la edad $j$ para cada stock $s$.
% \end{itemize}
Now for the year $y=y_N+1$:
\begin{equation}
SSB^s_{y_N+1}=e^{\mu^s_{R,y_N+1}}(S^{s}_{y_N,1})^{s_f}{wt\_{mat}}^s_1+\sum_{a=2}^{m-1}(N^{s}_{y_N,a-1}S^{s}_{y_N,a-1})(S^s_{y_N,a})^{s_f}wt\_{mat}^s_a
\end{equation}
\begin{equation*}
+(N^{s}_{y_N,m-1}S^s_{y_N,m-1}+N^s_{y_N,m}S^s_{y_N,m})(S^s_{y_N,m})^{s_f}wt\_{mat}^s_{m}.
\end{equation*}
But if the number of projected years is $nyrs_{proj}>0$ then the SSB for the next year ($SSB^s_{y_N+1}$) is also projected over time as a function of futures numbers at age ($N^s_{fut}$) and survival rate ($S^s_{fut}$):
\begin{equation}
SSB^s_{y_N+1}= \sum_{a=1}^m wt\_{mat}^s_a{N_{fut}}^s_{y_N+1,a}({{S_{fut}}^s_{y_N+1,a}})^{s_f}
\end{equation}
where:
\begin{itemize}
\item ${S_{fut}}^s_{y_N+1,a} = e^{-M^s_{y_N}}$, is the survival rate future for %iscen i=6
for the sixth projection scenario. The projection scenarios can be consulted in section \ref{Fproj} Fishing mortality for projections.
\item ${N_{fut}}^s_{y_N+1,a} = N^s_{y_N,a-1}S^s_{y_N,a-1}, \ \ 2\leq a \leq m-1$
\item ${N_{fut}}^s_{y_N+1,m} = N^s_{y_N,m-1}S^s_{y_N,m-1}+N^s_{y_N,m}S^s_{y_N,m}$, \ \ $a = m$
\item ${N_{fut}}^s_{y_N,1} = SRecruit(SSB^s_{y_N+1-r_a},cum\_regs(s)+yy\_sr(s,y_N)).e^{\epsilon^s_{y_N+1}}$, where $SRecruit()$ is a function of spawning biomass and the number of regimens (for this function see f. Recruitment \ref{ch: recruitment}).
$\epsilon^s_{y_N+1}$, in this case, is the future annual (for the year $y_N+1$) recruitment deviation for the stock $s$.
\item $yy\_sr$ is a matrix of regimes where each row is a stock $s$ and column is a year $y$ with $styr\_sp \leq y \leq y_N + nyrs_{proj}$, i.e., $yy\_sr(s,y)$ is the index of the regime, of stock $s$, to which year $y$ belongs.
\item $cum\_regs(s)$ is the sum of the number of regimes from stock 1 to stock $s-1$. For $s=1$ it is initialized with $cum\_regs(1)=0$.
\end{itemize}
%SRecruit is calculated in the recruitment section (from equation 50), it is a function with spawning biomass as the first argument and a regime number as the second argument.
\hfill
\subsubsection{c. Catches}\label{ch: catches}
When the model is using the Popes approximation, the total catch of a stock ($C^s_{y,a}$) is calculated as a function of ${C_{tmp}}^{k_s}_{y,a}$ for each stock \textit{s} ($1\leq s \leq n_{stk}$) at age \textit{a} in the year \textit{y} ($y_0 \leq y \leq y_N$) as follows:
\begin{equation}
{C_{tmp}}^{k_s}_{y,a}=N^s_{y,a} e^{-0.5M^s_{y,a}} Se_{y,a}^{k_s} \dfrac{c_{tmp}^{k_s}}{v_{bio}^{k_s}}, \ \ 1\leq a \leq m, \ \ \text{where}
\end{equation}
\begin{equation}
v_{bio}^{k_s}=\sum_{a=1}^m N^s_{y,a} e^{-0.5M^s_{y,a}} Se_{y,a}^{k_s} wt\_fsh^{k_s}_{y,a}, \ \ \text{and}
\end{equation}
%\item If $popes=TRUE$, then pentmp=0. Let $k_s$ the fisheries that correspond to the stock $s$:
% para $1\leq a \leq m$, where
% \begin{equation}
% vbio=\sum_{a=1}^mN^s_{y,a}.e^{-\frac{M^s_{y,a}}{2}}.sel\_fsh_a(k_s,y).wt\_fsh_a(k_s,y),
% \end{equation}
% and
\begin{equation}
c_{tmp}^{k_s} = v_{bio}^{k_s}-posfun\left(\frac{v_{bio}^{k_s} - {C_{obs}}_{k_s,y}}{v_{bio}^{k_s}} , 0.1 , pen_{tmp}=0 \right) v_{bio}^{k_s}, fpen(4)=pen_{tmp},
\end{equation}
$k_s$ denotes the fisheries that correspond to the stock $s$. Note ${C_{tmp}}^{k_s}_{y,a}$ is different to $c_{tmp}^{k_s}$, $c_{tmp}^{k_s}$ is a
%resource
function for calculate ${C_{tmp}}^{k_s}_{y,a}$. In ADMB, the $posfun()$ function constrains the argument $\displaystyle x = \frac{v_{bio}^{k_s} - {C_{obs}}_{k_s,y}}{v_{bio}^{k_s}}$ to be positive, it follows the net instruction: if $(x\geq eps=0.1)$ then returns x, otherwise $pen_{tmp}=0.01(x-eps)^2$ and returns $eps/(2-x/eps)$, $pen_{tmp}$ is a penalty function which is part of $fpen(4)$ which is a summand of the function $obj\_fun$ (function to be minimized).
% \begin{equation}
% catch\_tmp=vbio-posfun\left(\frac{(vbio - catch\_bio(k_s)_y)}{vbio} , 0.1 , pentmp \right).vbio,
% \end{equation}
Then the catch of the stock ($C$), catch-at-age ($Cat$) and the predicted catch ($C_{pred}$) are calculated as follows:
\begin{equation}
%catage\_tot(s,i)+=Ctmp, consultar
C^s_{y,a}=\sum_{k_s}{C_{tmp}}^{k_s}_{y,a}
%(sum on the fisheries belonging to the stock s)
\end{equation}
\begin{equation}
%catage(k,i)=Ctmp
Cat^{k_s}_{y,a}={C_{tmp}}^{k_s}_{y,a}, \ \ \ 1\leq a \leq m
\end{equation}
In the last optimization phase, the predicted catch for the fishery $k_s$ in the year $y$ is calculated as follows
\begin{equation}
{C_{pred}}^{k_s}_y=\sum_{a=1}^{m}{C_{tmp}}^{k_s}_{y,a} wt\_fsh^{k_s}_{y,a}
\end{equation}
%$\begin{equation}
%pred\_catch(k_s,y)=\sum_{a=1}^{m}Ctmp_a.wt\_fsh_a(k_s,y).
%\end{equation}
where:
\begin{itemize}
%\item $C^s_{y,a}$ is the total catch of stock $s$ for year $y$ at age $a$. It is used in eq. 6.
%\item $Cat(k,y)_a$ is the catch at age $a$ of fishery $k$ in year $y$. It is used in eq. 6.
%\item pred\_catch(k,y) is the predicted catch for year $y$ of fishery number $k$.
\item $Se_{y,a}^{k_s}$ is the fishing selectivity of the fishery $k$ at the age $a$ in the year $y$;
\item $wt\_fsh^{k}_{y,a}$ is the weight at age $a$ for the fishery $k$ in the year $y$ of observation;
%Is input, line 80 of .dat file.
\item $C_{obs}$ is the observed catch.
%\item catch\_bio is the observed catch biomass
% \begin{equation}
% catch\_bio(k)_y=catch\_bio\_in(k)_y,
% \end{equation}
% where $1\leq k \leq nfsh$ y $y_0\leq y \leq y_N$.
%\item $catch\_bio\_in(k)_y$ is the observed catch of fishery $k$ in year $y$. Is input, line 16 of .dat file.
\end{itemize}
However, when the Pope's approximation is not used, the catch-at-age and predicted catch are estimated as follows:
\begin{equation}
Cat^{k_s}_{y,a} = \dfrac{F^{k_s}_{y,a}}{F^s_{y,a}+M^{s}_{y,a}}\left(1-S^s_{y,a}\right)N^s_{y,a}
\end{equation}
%\begin{equation}
%Cat(k_s,y)_a=\dfrac{F^{k_s}_{y,a}}{Z^s_{y,a}}\left(1-S^s_{y,a}\right)N^s_{y,a},
%\end{equation}
\begin{equation}
{C_{pred}}^{k_s}_y = \sum_{a=1}^{m}Cat^{k_s}_{y,a} wt\_fsh^{k_s}_{y,a}
\end{equation}
%\begin{equation}
%pred\_catch(k,y)=\sum_{a=1}^{m}Cat(k,y)_a.wt\_fsh_a(k,y),
%\end{equation}
%where $Z^s_{y,a}=F^s_{y,a}+M^{s}_{y}$
\hfill
\subsubsection{d. Calculation of virgin biomass}
The virgin biomass of a stock $s$ is calculated for each regime $r$ ($1 \leq r \leq n_{reg_s}$%, $n_{regs}$ is the total number of regimes
). This calculation is needed for recruitment estimation, and is calculated as follows:
\begin{equation} \label{eq: b01}
B^{s,1}_0 = wt\_{mat}^s_1 e^{(-M^s_{y_0,1})(s_f)} R^{s,1}_0
+\sum_{a=2}^{m-1} wt\_{mat}^s_a e^{(-M^s_{y_0,a})(s_f)} R^{s,1}_0\prod_{l=1}^{a-1}e^{-M^s_{y_0,l}}
\end{equation}
\begin{equation*}
+ wt\_{mat}^s_{m} e^{(-M^s_{y_0,m})(s_f)}\frac{R^{s,1}_0}{1-e^{-M^s_{y_0,m}}}\prod_{l=1}^{m-1}e^{-M^s_{y_0,l}},
\end{equation*}
and for the rest of regimes
\begin{equation} \label{eq: b0r}
B^{s,r}_0 = SSB^s_{reg\_shift^s_{r-1}-r_a}, \ \ \ 2\leq r \leq n_{reg_s};
\end{equation}
where:
\begin{itemize}
%\item $n_{regs}$ is the total number of regimes, that is the sum of the number of regimes of all stocks;
\item $n_{reg_s}$ is the number of regimes of stock number $s$;
%\item %Bzero(cum\_regs(s)+1) es la biomasa virgen en el primer régimen del stock s.
%$B^{s,1}_0$ is the virgin biomass for the first regime belonging to the stock $s$;
\item $B^{s,r}_0$ is the virgin biomass for regime $r$ belonging to stock $s$ with $1\leq r \leq n_{reg_s}$;
\item $R_0^{s,1}$ is the recruitment for the first regime belonging to the stock $s$. It is obtained in section \ref{ch: s-r};
%\item $reg\_shift(s,r-1)$ year of regime change, is input in line 41 of .ctl file, for each stock s and regime number $r$.
\item $reg\_shift^s_{r-1}$ year of regime change, is input in control file, for each stock $s$ and regime number $r$.
%\item $a_R$ rec\_age$ is the age at which recruitment is feasible.
\end{itemize}
\hfill
\subsubsection{e. Stock-Recruitment parameters} \label{ch: s-r}
%Let $r$ be a given regime number, that is, $1\leq r \leq nregs$.\\
The parameters of the recruitment curve, $\alpha^r$ and $\beta^r$ for each regimen $r$ ($1\leq r \leq n_{regs}$, $n_{regs}$ is the total number of regimes of all stock numbers), are calculated according to the specified stock-recruitment relationship type ($sr_{type}$). These parameters are also parameterized in terms of the steepness of the stock-recruitment relationship ($h$), the recruitment to the first regime of stock ($R_0$), and the virgin biomass ($B_0$).\\
Using the Ricker stock-recruitment relationship ($sr_{type} = 1$):
\begin{equation}
\alpha^r = log\left(\dfrac{-4h^{r}}{h^{r}-1}\right),
\end{equation}
Using the Beverton-Holt stock-recruitment relationship ($sr_{type} = 2$):
\begin{equation}
\alpha^r = \dfrac{B^{r}_0}{R^{r}_0}\left(\dfrac{1 - h^{r}}{4h^{r}}\right),
\end{equation}
\begin{equation}
\beta^r = \dfrac{5h^{r}-1}{4h^{r}R^{r}_0}
\end{equation}
When $sr_{type}$ = 4:
\begin{equation}
\beta^r = log\left(\dfrac{5h^{r}} {0.8 B^{r}_0}\right)
\end{equation}
\begin{equation}
\alpha^r = log\left(\dfrac{R^{r}_0} {B^{r}_0}\right) + \beta .B^{r}_0,
\end{equation}
where:
\begin{itemize}
\item $R^{r}_0$ is the recruitment for the regimen $r$ ($1\leq r \leq n_{regs}$). It is calculated from:
% \begin{equation}
% R^r_0=e^{log\_Rzero^r},
% \end{equation}
\begin{equation}
R^r_0=e^{log\_Rzero(r)},
\end{equation}
$log\_Rzero$ is a vector parameter to be estimated and it has $n_{regs}$ elements.
\item $h^{r}$ is the steepness of the regimen $r$.
%\item $h^{r_s}$ is the steepness of the regimen $r_s$ of all regimes belonging to stock \textit{s}, \textit{s} is the stock to which regime r belongs. Remember that r is varying among the total number of regimes of all stocks.
\item $B^{r}_0$ is the virgin biomass for the regimen $r$ when $1\leq r \leq n_{regs}$. This is obtained from $B^{r}_0:=B^{s,r_s}_0$ where $s$ is the stock to which the $r$ regime belongs and $r_s$ is the index of regime $r$ among all regimes belonging to stock $s$ (i.e. when it corresponds to the first, second, third, etc. regime of stock $s$). Finally, $B^{s,r_s}_0$ is calculated in section $d$ (equations \ref{eq: b01} and \ref{eq: b0r}). Analogously it follows for $R^{r}_0 := R^{s,r_s}_0$.
%It is valid to say that $B^{r}_0=B^{s,r_s}_0$ when $r$ is the order that the regime $r_s$ takes when considering $1\leq r \leq n_{regs}.$
%\item $irec=rec\_map(stk\_reg\_map(1,r),stk\_reg\_map(2,r))$, where $rec\_map$ is the recruitment matrix, it is input in the line 23 of .ctl file.
%\item $stk\_reg\_map$ is a matrix of dimensions 2xnregs, where $stk\_reg\_map(2,r)$ is the regime number $r_s$, with $1\leq r_s \leq nreg(s)$, corresponding to stock number $s=stk\_reg\_map(1,r)$.
\end{itemize}
\hfill
\subsubsection{f. Recruitment} \label{ch: recruitment}
The number of recruits is calculated for each year $y$, $y_0\leq y \leq y_N+1$, and stock $s$ ($1\leq s \leq n_{stk}$), as follows:
\begin{equation}
recruits^s_y =N^s_{y,a = 1}, \ when \ y_0\leq y \leq y_N\ \text{and}
%es calculado en la función calc_dependent_vars
\end{equation}
\begin{equation}
recruits^s_{y}=e^{\mu^s_{R,y_N+1}}, \ when \ y = y_{N+1}.
\end{equation}
Also, the recruitment is calculated according to a specified type of the stock-recruitment relationship. For plotting the stock-recruitment curve (i.e. $stk^r_i$ vs $SRecruit(stk^r_i, r)$), this depends on the virgin biomass of the stock ($stk_i^r$), where:
\begin{equation}
stk^r_i=\dfrac{2i . B^{r}_0}{250}, \ \ 1\leq i \leq 300, \ 1\leq r \leq n_{regs},
\end{equation}
$SRecruit(s_{tmp}, r)$ is the recruitment depending of the stock ($s_{tmp}$) and regime $r$ ($1\leq r \leq n_{regs}$), defined by:
\begin{itemize}
\item When $sr_{type}=1$ (Ricker form%from Dorn
):
\begin{equation} \label{srecruit}
SRecruit(s_{tmp}, r) = \dfrac{R^{r}_0 .s_{tmp}}{B^{r}_0}e^{\alpha^r \left(1-\dfrac{s_{tmp}}{B^{r}_0}\right)}m,
\end{equation}
\item When $sr_{type}=2$ (Beverton-Holt form):
\begin{equation}
SRecruit(s_{tmp}, r) = \dfrac{s_{tmp}}{\alpha^r+\beta^r s_{tmp}},
\end{equation}
\item When $sr_{type}=3$ (mean recruitment):
\begin{equation}
SRecruit(s_{tmp}, r) = e^{\mu_{R,r}},
\end{equation}
where $\mu_{R,r}$ is the average recruitment in the regime $r$.
\item When $sr_{type}=4$ (old Ricker form):
\begin{equation}
SRecruit(s_{tmp}, r) = s_{tmp} e^{\alpha^r-s_{tmp} \beta^r}.
\end{equation}
\end{itemize}
$n_{regs}$ is the total number of regimes i.e $n_{regs} = \displaystyle\sum_{s=1}^{n_{stk}} n_{reg_s}$.
%Finally, the points are plotted $(stock^r_i, SRecruit(stock^r_i,r))$ for each regime $1\leq r \leq nregs$.
\hfill
\subsubsection{g. Growth model} \label{ch: g}
For the fish growth, the JJM uses the von Bertalanffy growth model as follows:
\begin{equation}
\mu_{age}(g,1)=L_0(g)
\end{equation}
\begin{equation}
\mu_{age}(g,i)=L_{\infty}(g)(1-e^{-{k\_coeff(g)}})+\mu_{age}(g,i-1)(e^{-k\_{coeff(g)}}).
\end{equation}
\begin{itemize}
\item $\mu_{age}(g,i)$ is the mean length for each age $i$ with $1\leq i \leq m$.
\item $g$ is a integer with
$1\leq g \leq n_{growth}$ ($n_{growth}$ is the maximum of the Growth map matrix elements).
\item $L_{\infty}(g)$ is the maximum length.
\item $k\_coeff(g)$ is the growth coefficient or curvature parameter.
\item $L_0(g)$ is the length initial.
\end{itemize}
% \begin{equation}
% \mu_{age}(r,1)=L_0(r)
% \end{equation}
% \begin{equation}
% \mu_{age}(r,i)=Linf(r)(1-e^{-{k\_coeff(r)}})+\mu_{age}(r,i-1)(e^{-k\_{coeff(r)}}).
% \end{equation}
% \begin{itemize}
% \item $\mu_{age}(r,i)$ is the mean length for each age $i$.
% \item $r$ is a integer with %between
% $1\leq r \leq n_{growth}$ ($n_{growth}$ is the maximum of the Growth map matrix elements).
% \item $Linf(r)$ is the maximum length.
% \item $k\_coeff(r)$ is the parameter curvature.
% \item $L_0(r)$ is the length initial.
% \end{itemize}
\hfill
\subsubsection{h. Equation weight at length}
\begin{equation}
wt\_age\_vb(g,i) = lw\_a \left(\mu_{age}(g,i)\right)^{lw\_b}
\end{equation}
\begin{itemize}
\item $wt\_age\_vb(g,i)$ is the weight at length $\mu_{age}(g,i)$ \ref{ch: g}.
\item $lw\_a$, $lw\_b$ are growth parameters given by $lw\_a=0.007778994e-3$ and $lw\_b=3.089248476$ in the model.
\end{itemize}
\hfill
\subsubsection{i. Maturity equation}
% \begin{equation}
% maturity\_vb(r,i) = \dfrac{1}{1+e^{32.93-1.45.\mu_{age}(r,i)}}
% \end{equation}
\begin{equation}
maturity\_vb(g,i) = \dfrac{1}{1+e^{32.93-1.45.\mu_{age}(g,i)}}
\end{equation}
% \begin{itemize}
% \item $maturity\_vb(r,i)$ is the proportion of mature species at length $\mu_{age}(r,i)$ for $1\leq i \leq m$.
% \end{itemize}
\begin{itemize}
\item $maturity\_vb(g,i)$ is the proportion of mature species at length $\mu_{age}(g,i)$ where $g$ and $i$ as in section g \ref{ch: g}.
\end{itemize}
\hfill
\subsubsection{j. Matrix age composition to length composition}
It uses a normal distribution to calculate the probability:
\begin{equation} \label{eq: page}
P(l-0.5\leq X_a\leq l+0.5 ) = P\left(\dfrac{(l-0.5)-\mu_a}{\sigma_a}\leq Z\leq\dfrac{(l+0.5)-\mu_a}{\sigma_a}\right),
\end{equation}
\begin{equation*}
Z = \dfrac{X_a-\mu_a}{\sigma_a},
\end{equation*}
where $P(l-0.5\leq X_a\leq l+0.5 )$ is the probability that the number of fish at age $a$ varies in length between $l-0.5$ and $l+0.5$.\\
Be the fixed integer $g$ such that $1\leq g \leq n_{growth}$.
The right expression in (\ref{eq: page}) is the normalization for $X_a$ since $X_a$ is (assumed) a random variable with normal distribution with mean $\mu_a =\mu_{age}(g,a)$ and standard deviation $\sigma_{a}= sd_{age}(g) \mu_{age}(g,a)$. \\
$P\_age2len_g$ is the matrix such that $Cl(1,nyears,1,n_L) = C(1,nyears,1,m) P\_age2length_g$ where $n_L$ (input) is the number of sizes considered %(input line 9 in .dat file)
. $Cl$ is the annual length composition matrix, and $C$ is the annual ages composition matrix. The elements of $P\_age2len_g$ are defined as:
\begin{equation}
P\_age2len_g(a,j) = \dfrac{P(l_j-0.5\leq X_a\leq l_j+0.5 )}{\displaystyle\sum_{j=1}^{n_L}P(l_j-0.5\leq X_a\leq l_j+0.5 )},
\end{equation}
\begin{itemize}
%\item $P\_age2len$ is a array with dimensions $(1,n_{growth},1,m,1,n_L)$.
\item with age $1\leq a \leq m$ and size $1\leq j \leq n_L$,
\item $sd_{age}(g)$ is obtained for each $g$ with $1\leq g\leq n_{growth}$ as $sd_{age}(g) = e^{log\_sdage(g)}$, where $log\_sedage$ is a parameter that can be estimated.
\item $l_j$ is the length $jth$ considered from the vector $len\_bins$ (vector sizes, input in data file).
\end{itemize}
In addition, the sum over all the lengths of the matrix $Cl$ is equal to the sum over all ages. In fact $Cl_{i,j} = \displaystyle\sum_{k=1}^m C_{i,k} P\_age2len_r(k,j) = \displaystyle\sum_{k=1}^m C_{i,k} \dfrac{P(l_j-0.5\leq X_k\leq l_j+0.5 )}{\displaystyle\sum_{j=1}^{n_L}P(l_j-0.5\leq X_k\leq l_j+0.5 )}$, then
$\displaystyle\sum_{j=1}^{n_L}Cl_{i,j} = \displaystyle\sum_{k=1}^m{C_{i,k}}$.
\subsubsection{k. Survey Predictions} \label{surveypred}
Prediction for the index number \textit{k} in year \textit{y} is denoted by $pred\_ind(k,y)$, where $1\leq y \leq nyrs_{ind}^k$ and $nyrs_{ind}^k$ is the number of observation years for a index survey $k$.\\
%(is located on line 138 of the .dat file).\\
Let's first look at the equations for $q\_ind(k,y)$ for each $k$ survey ($1\leq k \leq n_{ind}$) and each year $y$ of observation ($1\leq y \leq nyrs_{ind}^k$). This is explained by cases as follows:
\begin{equation}
q\_ind(k,y) = e^{log\_q\_ind(k)}, \ for \ 1\leq y \leq yrs\_rw\_q^k_1 %yrs\_rw\_q(k,1)
-yrs\_ind(k,1)
\end{equation}
Now let $i\in\mathbb{N}$ such that $2\leq i \leq npars\_rw\_q^k$ and $p_i=yrs\_rw\_q^k_{i-1}-yrs\_ind(k,1)+1$, then:
\begin{equation}
q\_ind(k,y) = q\_ind(k,p_i -1)e^{log\_rw\_q\_ind(k,i-1)}, \ for \ p_i\leq y \leq p_{i+1}-1
\end{equation}
and for $i=1+npars\_rw\_q^k :$
\begin{equation}
q\_ind(k,y) = q\_ind(k,p_i-1) e^{log\_rw\_q\_ind(k,i-1)}, \ for \ p_i\leq y \leq nyrs^k_{ind},
\end{equation}
% now let $i\in\mathbb{N}$ such that $2\leq i \leq 1+npars\_rw\_q^k$ and $p_i=yrs\_rw\_q(k,i-1)-yrs\_ind(k,1)+1$ then
% \begin{equation}
% q\_ind(k,p_i) = q\_ind(k,p_i-1)*e^{log\_rw\_q\_ind(k,i-1)};
% \end{equation}
% and for the rest of the cases
% \begin{equation}
% q\_ind(k,iyr) = q\_ind(k,p_i), \ for \ p_i+1\leq iyr \leq nyrs_{ind}^k.
% \end{equation}
where:
\begin{itemize}
\item $log\_q\_ind_k$ is the logarithm of the survey catchability coefficient ($q\_ind$). It is a parameter to be estimated for each index survey $k$. %and defined as $log\_q\_ind(1,n_{ind},phase\_q)$.
It is initialized with $log\_qprior=log(q^{prior})$ where $q^{prior}$ is part of the model input.
% yrs_ind(k) = yrs_ind_in(k)(1,nyrs_ind(k)), yrs_ind_in es input linea 141 del dat
\item $yrs\_ind(k,1)$ is the first year of observation for the index survey $k$.
\item $yrs\_rw\_q^k_i$ is input for each index survey $k$ and $1\leq i \leq npars\_rw\_q^k$. %line 95 of .ctl file.
\item $yrs\_ind(k)$ is the set of years of observation of survey number $k$.
\item $log\_rw\_q\_ind(k)$ is a parameter (vector with $npars\_rw\_q^k$ elements) to be estimated for each index survey $k$.
%and defined as \\ $log\_rw\_q\_ind(1,n_{ind},1,npars\_rw\_q,phase\_rw\_q) $.
\item $npars\_rw\_q^k$ is input for each index survey $k$.
\end{itemize}
Now is calculated the prediction for the survey number $k$ in the year $1\leq y \leq nyrs_{ind}^k$ as:
% \begin{equation}
% pred\_ind(k,y)=q\_ind(k,y)*
% \end{equation}
% % \begin{equation}
% % \left(\left(\sum_{age \ j}natage_j(istk,iyr).S(istk,iyr)_j^{ind\_month\_frac(k)}sel\_ind_j(k,iyr).wt\_ind_j(k,iyr)\right)\right)^{q\_power\_ind(k)}
% % \end{equation}
% \begin{equation}
% \left(\sum_{j=1}^mN^{istk}_{iyr,j}.{S^{istk}_{iyr,j}}^{ind\_month\_frac(k)}sel\_ind_j(k,iyr).wt\_ind_j(k,iyr)\right)^{q\_power\_ind(k)},
% \end{equation}
\begin{equation} \label{eq: predind}
pred\_ind(k,y)=q\_ind(k,y).
\left(\sum_{j=1}^mN^{istk}_{iyr,j}.{S^{istk}_{iyr,j}}^{ind\_month\_frac(k)}sel\_ind_j(k,iyr).wt\_ind_j(k,iyr)\right)^{q\_power\_ind(k)},
\end{equation}
where $iyr=yrs\_ind(k,y)$, besides:
\begin{itemize}
%\item $n_{ind}$ is the total number of index.
\item $yrs\_ind(k,y)$ is the $yth$ year belonging to the set $yrs\_ind(k)$.
%\item $ind\_month\_frac$ es un vector de dimensiones (1,nind) y se calcula como $ind\_month\_frac(k)=\dfrac{mo\_ind(k)-1}{12}$, donde $mo\_ind(k)$, para cada pesquería número $k$, está en la línea 144 del archivo dat.
\item $ind\_month\_frac$ is calculated for each fishery $k$ as $ind\_month\_frac(k)=\dfrac{mo_{ind}(k)-1}{12}$, where $mo_{ind}$ is input.
%is on line 144 of the .dat file.
\item $istk=sel\_map(1,k+n_{fsh})$
i.e., it is the stock number corresponding to the index survey number $k$.
%\item $iyr=yrs\_ind(k,i)$, índice número $k$ y año número $i$.