# knobi

    library(knobi)

In this vignette we illustrate the use of the `knobi` package through a real case example. For this purpose, the formulation of the Known Biomass Production Models (KBPMs) is explained and then each of the functions of the package is described and applied to a real case study.

Please note that this vignette does not cover all possibilities for each function in this package (i.e., not all arguments or combinations of arguments are used). Instead, it focuses on describing the basic usage of the functions, with some alternatives included for certain functions. For more detailed information, please refer to the help documentation for each function in the package.

## 1. KBPM formulation

For a correct understanding of KBPM models, we start reviewing the surplus production models (SPMs) framework and then based on this background the KBPM formulation is described.

Traditional SPMs are one of the most widely used data-limited (or data moderated) assessment models. Their general structure relates directly to Russell’s formulation of the stock dynamics:

\[B_{t+1}=B_t + f(B_t)-C_t\] Eq. (1)

where Bt is the stock biomass at the beginning of year t, Ct is the biomass caught during year t and f(Bt) is the biomass production function.

There are many formulations of the biomass production function f(Bt), among which the general Pella-Tomlinson (1969) is widely used:

\[f(B_t) = \frac{r}{p}{B_{t}} \left(1-\left( \frac{B_{t}}{K}\right) ^{p}\right)\] Eq. (2)

where r is the intrinsic population growth rate, K is the carrying capacity and p is the asymmetry parameter, which allows non-symmetrical production curves and, consequently, maximum production different from K/2. Schaefer (1954) model corresponds to p=1 (symmetric production curve and \(SP_{max}=K/2\)).

SPMs link the population dynamics, i.e. Eq. (1) with the observations through the relation between the catch and the stock biomass across the catchability coefficient (q).

\[\hat{I}_t=C_t/E_t=qB_t\] where It is the value of the relative biomass index for year t, notation ˆ denotes an estimated value and q is the catchability coefficient, which scales the modeled stock biomass to match the trends in catch rates.

An alternative line of research based on surplus production models named known-biomass production models (KBPM) was developed (MacCall, 2002). The basis of the KBPM model is the idea that the annual surplus production in an unfished stock is equal to Bt+1-Bt, and that, for a fished stock, the calculation of surplus production depends on catch.

\[SP_t=\overline{B}_{t+1}-\overline{B}_t+C_t\] Eq. (3)

where SPt is the surplus production during year t, Bt is the average biomass or SSB, Bt=(Bt+Bt+1)/2, and Ct represents the catch during year t.

In contrast to the traditional SPMs, KBPMs use as input data a biomass time series, estimated using another stock assessment model, instead of a biomass index.

Once the surplus production is calculated using the known average biomass (of two consecutive years) and the observed catch, the KBPMs are fitted as:

\[SP_{t}= \frac{r}{p}\overline{B}_{t}\left(1-\left( \frac{\overline{B}_{t}}{K}\right) ^{p}\right)\] Eq. (4)

## 2. `knobi` package

In this section the `knobi` package functions are described. More precisely, in each one of the next subsections the following package functions are explained:

1. `knobi_fit`: fits the KBPM model (main function).

2. `knobi_env`: analyzes the production changes in response to environmental fluctuations.

3. `knobi_retro`: carries out the retrospective analysis.

4. `knobi_proj`: projects the population and fishery dynamics.

### 2.1. `knobi_fit`

This section illustrates the use of the `knobi_fit` function, which allows us to fit the KBPM model.

For that, the case study of European hake (\(Merluccius\) \(merluccius\)) is used. European hake is a resource of great commercial importance in Atlantic Iberian Waters. This species is assessed by the International Council for the Exploration of the Sea (ICES) in two units: the northern and the southern stocks. For the current illustration we focus on the northern hake unit which covers the subareas 4, 6, and 7, and divisions 3.a, 8.a–b, and 8.d (Greater North Sea, Celtic Seas, and the northern Bay of Biscay).

#### Creating `data` argument

The first step is to create the `data` input object.

The data was downloaded using the `icesSAG` package and saved in the `knobi_dataset` under the `hake_n` object.

    data( knobi_dataset)
    hake_n <- knobi_dataset$hake_n

Then the `data` list for `knobi_fit` is created. Mandatory data are the catch time series and the biomass or SSB time series. However, in this example we also include some additional available information.

As you can see, in the code below, the data input argument is created. Firstly we introduce both, the biomass and spawning stock biomass (SSB) series, then below in the `control` argument we indicate which of the two series is used in the fit. After that, in the next line of code, we introduce the second data source which are the catches. After introducing the two main sources of information, we can add more details that are used mainly for comparing KBPM results with those derived from the assessment model that produced the SSB estimates (a data-rich model). In this particular case, we add the recruitment series, the value of the reference point \(F_{msy}\) and the years associated to the observed catch time series (if omitted, an increasing sequence from 1 onward will be used).

Details about the optional entries of this argument can be found on the help page.

    data <- list(
      SSB = hake_n$SSB,
      Catch = hake_n$catches,
      F_input = hake_n$F,
      Recruitment = hake_n$recruitment,
      RP = list( F_MSY = 0.26),           # Provided by ICES
      years = hake_n$Year )

#### Creating `control` object

`control` list contains a set of settings for the KBPM fit. In this example. it includes the argument `pella`, which is an optional logical argument where “TRUE” means that Pella-Tomlinson model is fitted instead of the Schaefer one.

    control <- list( pella = "TRUE")

There is the possibility of defining other `control` settings such as `start_r`, `start_K` or `start_p`, optional start values of the model parameters \(r\) (intrinsic growth rate), \(K\) (maximum population size) and \(p\) (shape parameter in Pella-Tomlinson model), respectively.

#### KBPM model fit

After preparing both lists, `data` and `control`, we can apply the `knobi_fit` function over them for fitting the KBPM model.

In addition to the arguments mentioned above, the `plot_out=TRUE` argument allows the creation of an external folder with the corresponding plots files also displayed in the plot window. We can set the folder name and its directory through the `plot_filename` and the `plot_dir` arguments, respectively.

    hake_n_results <- knobi_fit( data = data,
                                 control = control,
                                 plot_out = FALSE)

Note that if the length of the input catch time series does not match with the SSB length, a warning is returned indicating that the series of catch is reduced so that the fit can be done.

    #> Warning in knobi_fit(data, control, plot_out = FALSE): The length of the catch
    #> time series is reduced according to biomass or SSB time series length.

As you can see, the following input quantities are plotted: fishing mortality time series, SSB, surplus production and catch time series. Note that in this example we are using `control$method=SSB`, which means that we are going to operate with the SSB and not with the stock biomass. Plots of catch over fishing mortality, fishing mortality over SSB, and catch over SSB time series with a smooth line from a “loess” regression are also displayed. Plot of input-output time series of fishing mortality is also provided with horizontal lines at fishing mortalities at MSY (two lines representing both input and output). The fishing mortality relative to \(F_{msy}\) is also plotted including a reference horizontal line at 1. The analogous SSB plots are also reported. It is important to mention that, in these cases, inputs are represented in blue and outputs in red, highlighting the case of the SSB, where the absolute value is an input of the model, while the relative SSB (SSB/SSBmsy) depends on the estimation of the reference point, so it is represented in red as well. On the other hand, the fitted surplus production curve is plotted twice with the observed Sp over SSB (first plot) and with the catch over SSB observations (second plot). Finally, a plot with the KBPM fit residuals is shown.

#### Quantitative results

The formula and the parameter estimates of the fit are printed running the name of the output object.

    hake_n_results
    #>
    #>  Formula:
    #>  SP_t = (r/p)*B_t*(1-(B_t/K)^p)
    #>
    #> Parameter estimates:
    #> r  0.6303396
    #> K  529631.1
    #> p  0.25
    #>

The `hake_n_results` object is a list containing the following slots: (1) `params`, that is the estimated parameters in the fit; (2) `BRPs`, that are the biological reference points estimates; (3) the `residuals` of the fit; (4) an `error_table` with the error measures (5) the `input` list which is an updated version of its input including the annual average biomass, the surplus production and the F estimated time series; (6) the `control` output which is the input one updated with the information of the plot settings; and (7) the `optimx` slot with the results provided by the optimizing function. See the help page for a more completed description.

    hake_n_results$BRPs
    #>            K        B_MSY        F_MSY          MSY     MSYoverK
    #> 5.296311e+05 2.169369e+05 5.042717e-01 1.093951e+05 2.065497e-01

### 2.3. `knobi_env`

After carrying out the KBPM fit using `knobi_fit`, `knobi_env` function allows us to analyze and model the relationships between the surplus production and the environmental covariable(s) in order to test whether productivity changes in response to environmental fluctuations. The `knobi_env` procedure can be summarized in three steps:

1. The correlation analysis between the environmental variable(s) and the KBPM residuals through the Pearson’s correlation or autoregressive models;
2. The selection of which lagged environmental variable(s) is included in the environmental KBPM models fit;
3. The KBPM environmental fit.

In step (3) environmental covariables can be included as additive and multiplicative effects in the KBPM base formulation, i.e. in Eq. (4).

- Additive model:

\[SP_{t}= \frac{r}{p}\overline{B}_{t}\left(1-\left( \frac{\overline{B}_{t}}{K}\right) ^{p}\right) + cX_{t-lag}\overline{B}_{t}\] Eq. (5)

being c the parameter that represent the effect of the lagged environmental variable Xt-lag (t index represents years and \(lag\) represent the response variable \(lag\), as explained below).

- Multiplicative model:

\[SP_{t}= \frac{r}{p}\overline{B}_{t}\left(1-\left( \frac{\overline{B}_{t}}{K}\right) ^{p}\right)exp^{cX_{t-lag}}\] Eq. (6)

`knobi_env` inputs are the object returned by `knobi_fit` and a `data` object containing, at least, the mandatory environmental information required for the fit: the `env` argument, which is a data frame containing the values of each one of the environmental variable(s) in one column; and the `years` argument, which contains the years in which the environmental variable(s) are reported.

In the following example, we create a data frame in which we introduce the years in which the environmental variables are available, which is from 1973 to 2020. Then, we create two columns containing the values of Atlantic Multidecadal Oscillation (AMO) and the North Atlantic Oscillation (NAO) indices. Finally, we cut the data frame for starting in the first year of the KBPM fit data minus the value of the `nlag` or `lag` argument (below, a detailed explanation of this argument is provided).

    Env <- knobi_dataset$Env
    nlag <- 5
    years <- hake_n_results$df$Year

    ind <- which(Env[,1]==years[1])
    ind1 <- which(Env[,1]==years[length(years)])

    Env <- Env[(ind-nlag):ind1,]

Now, we create the `data` list

    data <- list(
      env = data.frame( AMO=Env$AMO, NAO=Env$NAO),
      years = Env$years)

In the optional `control` input list we provide the settings for the environmental fit. In this example, we set `nlag=5`. This argument specifies the maximum lag of the environmental variable to test in the correlation analysis, meaning that lags less than or equal to `nlag` (a natural number) are evaluated. This means that correlation between KBPM residuals at time t and Xt-lag, where X the environmental variable and lag takes values from 0 to `nlag`, is computed. The lagged environmental variable corresponding to the highest correlation with the KBPM residuals is included in the environmental model.

    control <- list( nlag = nlag)

Based on the arguments defined above, we apply the function as you can see below. Note that it reports a plot of the correlation analysis between the environmental variable(s) and the base KBPM residuals. Besides, a plot of the fitted values of the base model (no environmental information) and the environmental ones is also displayed. At last, a plot with the Pearson’s residuals for each KBPM model is also reported.

    hake_n_environmental <- knobi_env(knobi_results = hake_n_results,
                                      data = data,
                                      control = control,
                                      plot_out = FALSE)

#### Quantitative results

Running the name of the output object the formula and the parameters estimates for both environmental models fit are printed.

    hake_n_environmental
    #>
    #>  Multiplicative model:
    #>  SP_t = (r/p)*B_t*(1-(B_t/K)^p)*exp(c*X_t)
    #>
    #> Parameter estimates:
    #> r   0.6846295
    #> K   450802.6
    #> p   0.25
    #> c   0.178514
    #>
    #>
    #>  Additive model:
    #>  SP_t = (r/p)*B_t*(1-(B_t/K)^p)+c*X_t*B_t
    #>
    #> Parameter estimates:
    #> r   0.7340582
    #> K   393745.8
    #> p   0.25
    #> c   0.140194

A detailed description of each slot of the output function’s object is available in the help page. The output object contains the parameter estimates for both models and its reference points estimates, the accuracy measures for each model and the correlation analysis between the environmental variable(s) and the KBPM base residuals, among other results.

From Eq. (5) and Eq. (6) we can derive the formulas that provide the reference points (BRPs). It is important to take into account that in these models the BRPs depend on the value of the environmental covariate (details provided below for each model).

In the case of these environmental models, the estimated BRPs correspond to a value of the scaled environmental variable equal to the mean of the time series, i.e. \(X_t=0\), which cancels out the effect of the parameter \(c\). The estimates of the remain parameters included in the Eq. (2), and therefore for the BRPs as well, will be different from the base model ones because the fact of having included the environmental effect in the equations had an impact on the estimation of the curve.

The mathematical formulation of the BRPs estimates for each KBPM model depending on the centered environmental variable are:

- In the case of the multiplicative model

\[B_{msy}(X)=K\left(\frac{1}{p+1}\right)^{1/p}\] \[F_{msy}(X)=\frac{r}{p}\left(1-\frac{1}{p+1}\right) cX\] \[MSY(X)=B_{msy}(X)*F_{msy}(X)\] \[K(X)=K\]

where r, p, K and c are the model parameter estimates of the additive and multiplicative environmental models, i.e. Eq. (5) and Eq. (6) respectively; and X the centered environmental variable.

- In the case of the additive model

\[B_{msy}(X)=K\left(\frac{p c X+r}{r(p+1)}\right)^{1/p}\] \[F_{msy}(X)=\frac{r}{p}\left(1-\frac{1}{p+1}\right)-\frac{cX}{p+1}+cX\] \[MSY(X)=B_{msy}(X)*F_{msy}(X)\] \[K(X)=K+cX\]

where r, p, K and c are the model parameter estimates of the Eq. (5) and Eq. (6) and X the centered environmental variable.

For simplicity, the output slot `$BRPs` provides the BRPs estimates for a value of the centered environmental variable equal to the mean of the time series, i.e. , which cancels out the environmental effect in the equations defining both models, i.e. the effect of the parameter .

    hake_n_environmental$BRPs
    #>             K    B_MSY     F_MSY       MSY  MSYoverK
    #> Base 529631.1 216936.9 0.5042717 109395.12 0.2065497
    #> Add  393745.8 161278.3 0.5872466  94710.11 0.2405362
    #> Mult 450802.6 184648.7 0.5477036 101132.77 0.2243394

#### More options

There is the possibility of obtaining 3D plots reporting the surplus production curve conditioned to a grid of environmental values using the argument `control$plot3d=TRUE`. In this case, a list named `plots3D` is added to the output list of `knobi_env` with the 3D plots objects.

    control$plot3d = TRUE
    knobi_env( hake_n_results, data, control)

There is also the possibility of fixing which lag is used in the relation among the surplus production and the environmental variable, for that the `lag` argument is used instead of `nlag` inside `control` as you can see below

Furthermore, it is also possible to fit the environmental models considering several variables at the same time using `control$multicovar = TRUE`. This means that cXt is replaced by \(\sum_{i=1}^{N} c_i X_{t,i}\) in Eq. (5) and Eq. (6), where index N represents the number of environmental variables.

Below you can see how we introduce the same data set as in previous examples but in the control we set `multicovar=TRUE` so that the two variables, “AMO” and “NAO”, are considered in the environmental fit. Note that “AMO” is 2 years lagged whereas “NAO” is 3 years lagged respect the SP.

    control <- list( lag=c(2,3), multicovar=TRUE)
    hake_n_multi <- knobi_env( hake_n_results, data, control)

Finally, there is also the possibility of testing the correlation between the KBPM residuals and the environmental variable(s) through the fit of autoregressive models (AR models). In this case, firstly an AR model is fitted for the residuals in order to determine how the residuals can explain themselves:

\[ r_t=\sum_{i=1}^{\rho}\beta_{i}r_{t-i}+\epsilon_{t}\]

being rt the KBPM base residual for year t and \(\rho\) the AR model order, estimated as the maximum time lag at which the absolute value of the residuals partial autocorrelation is large than qnorm(0.975)Nr being Nr the length of the residuals series.

Then, AR models are fitted considering each one of the lagged environmental variable(s),

\[r_{t,lag}=\sum_{i=1}^{\rho}\beta_{i}r_{t-i}+X_{t-lag}+\epsilon_{t}\]

for lag=0,1,…,nlag, being Xt-lag the lagged environmental variable at year t-lag. Then, we have an autoregressive model for each of the lagged environmental variables. The AIC values of the above models are compared, and the lagged environmental variable whose model reports the lowest AIC is used in the KBPM fit, except if the argument ‘lag’ is used.

This test procedure is carried out using the argument `ar_cor = TRUE` in `control` list as you can see below.

    control_ar <- list( nlag=3, ar_cor=TRUE)
    hake_env_ar <- knobi_env( hake_n_results, data = data, control = control_ar)

A plot with the AIC values for each model is also represented. In the output object `env_aic` represents the AIC values for each AR model and `selected_lag` represent the lag corresponding to the model with the lowest AIC.

    hake_env_ar$env_aic
    #>         base    lag_0    lag_1    lag_2    lag_3
    #> AMO 44.34811 45.17681 34.60678 40.01703 44.16061
    #> NAO 44.34811 45.17681 41.32029 38.53076 40.20173

    hake_env_ar$selected_lag
    #>     lag      aic
    #> AMO   1 34.60678
    #> NAO   2 38.53076

### 2.3. `knobi_retro`

Once the KBPM fit is carried out using `knobi_fit` function, its robustness to the deletion of data is tested using the `knobi_retro` function.

`knobi_retro` input is the object returned by `knobi_fit` and the selected retrospective models. In this example, these models are specified by the `nR` argument, with a value of 5 (that is also the default value). This means that the first retrospective model considers the data deleting the last year and fits the surplus production curve, the next model deletes the two last years of the original data set and fits the SP curve, and then the process continues in this way until the last model is reached in which the last 5 years in the original data are deleted to then fit the curve.

    hake_n_retros <- knobi_retro( knobi_results = hake_n_results,
                                  nR = 5,
                                  plot_out = FALSE)

The estimated surplus production curves from the retrospective analysis are plotted. The plot is displayed in the plot window and also saved if `plot_out=T` in the provided directory and file.

#### Quantitative results

The `knobi_retro` output is a list containing the retrospective analysis, that includes the parameter estimates and the reference points for each one of the models.

    hake_n_retros
    #> $BRPs
    #>                    K    B_MSY     F_MSY      MSY  MSYoverK
    #> 1978 - 2019 529631.1 216936.9 0.5042717 109395.1 0.2065497
    #> 1978 - 2018 534350.5 218870.0 0.5047717 110479.4 0.2067545
    #> 1978 - 2017 547288.4 224169.3 0.5048596 113174.0 0.2067905
    #> 1978 - 2016 585744.5 239921.0 0.4944368 118625.8 0.2025213
    #> 1978 - 2015 625579.8 256237.5 0.4807142 123177.0 0.1969005
    #> 1978 - 2014 606781.3 248537.6 0.4869952 121036.6 0.1994733
    #>
    #> $params
    #>                     r        K    p
    #> 1978 - 2019 0.6303396 529631.1 0.25
    #> 1978 - 2018 0.6309646 534350.5 0.25
    #> 1978 - 2017 0.6310745 547288.4 0.25
    #> 1978 - 2016 0.6180460 585744.5 0.25
    #> 1978 - 2015 0.6008928 625579.8 0.25
    #> 1978 - 2014 0.6087441 606781.3 0.25

There is also another possibility for choosing the years to consider in each one of retrospective models. The `yR` argument specifies the final years of the catch time series for each of the retrospective models, providing greater flexibility in choosing the years from which to delete information. The number of retrospective fits will correspond to the length of the `yR` vector. Additionally, different starting years can be set using the `yR0` argument.

Below, there are two examples of the use of these arguments. In the first example, the retrospective models are fitted from the first year available in the time series (which is the year 1978) up to the years defined by `yR`(2005, 2010 and 2015), while in the second example the models fit from the years contained in `yR0` up to the years included in `yR`, i. e. , 1990 to 2005, from 1995 to 2010 and from 1995 to 2015.

    knobi_retro( hake_n_results,
                 yR = c(2005,2010,2015))

    #> $BRPs
    #>                     K     B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019  529631.1 216936.88 0.5042717 109395.12 0.2065497
    #> 1978 - 2005  154479.7  63274.88 0.9052966  57282.54 0.3708095
    #> 1978 - 2010 1059574.9 434001.88 0.4182296 181512.45 0.1713069
    #> 1978 - 2015  625579.8 256237.47 0.4807142 123177.00 0.1969005
    #>
    #> $params
    #>                     r         K    p
    #> 1978 - 2019 0.6303396  529631.1 0.25
    #> 1978 - 2005 1.1316207  154479.7 0.25
    #> 1978 - 2010 0.5227870 1059574.9 0.25
    #> 1978 - 2015 0.6008928  625579.8 0.25

    knobi_retro( hake_n_results,
                 yR = c(2005,2010,2015),
                 yR0 = c(1990,1995,1995))

    #> $BRPs
    #>                    K     B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019 529631.1 216936.88 0.5042717 109395.12 0.2065497
    #> 1990 - 2005 164718.6  67468.74 0.8630042  58225.81 0.3534865
    #> 1995 - 2010 391203.7 210004.26 0.8258184 173425.39 0.4433122
    #> 1995 - 2015 422793.8 195255.58 0.6960105 135899.92 0.3214331
    #>
    #> $params
    #>                     r        K         p
    #> 1978 - 2019 0.6303396 529631.1 0.2500000
    #> 1990 - 2005 1.0787553 164718.6 0.2500000
    #> 1995 - 2010 2.0000000 391203.7 1.4218399
    #> 1995 - 2015 1.1425156 422793.8 0.6415208

The environmental fit information can be considered too in the retrospective analysis through the `env_results` argument, where the result of the `knobi_environmental` function has to be provided. For environmental models, both the estimated BRPs and the plotted production curve correspond to a value of the scaled environmental variable equal to the mean of the time series, i.e. \(X_t=0\), which cancels out the environmental effect in the equations defining both models as it has been explained in the `knobi_env` function help’s details. In this case a panel of plots is provided, where each graph corresponds with a different model.

    knobi_retro(hake_n_results, hake_n_environmental, nR = 3); hake_n_retros

    #> $base
    #> $base$BRPs
    #>                    K    B_MSY     F_MSY      MSY  MSYoverK
    #> 1978 - 2019 529631.1 216936.9 0.5042717 109395.1 0.2065497
    #> 1978 - 2018 534350.5 218870.0 0.5047717 110479.4 0.2067545
    #> 1978 - 2017 547288.4 224169.3 0.5048596 113174.0 0.2067905
    #> 1978 - 2016 585744.5 239921.0 0.4944368 118625.8 0.2025213
    #>
    #> $base$params
    #>                     r        K    p
    #> 1978 - 2019 0.6303396 529631.1 0.25
    #> 1978 - 2018 0.6309646 534350.5 0.25
    #> 1978 - 2017 0.6310745 547288.4 0.25
    #> 1978 - 2016 0.6180460 585744.5 0.25
    #>
    #>
    #> $add
    #> $add$BRPs
    #>                    K    B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019 393745.8 161278.3 0.5872466  94710.11 0.2405362
    #> 1978 - 2018 396766.2 162515.4 0.5869989  95396.39 0.2404348
    #> 1978 - 2017 406535.6 166517.0 0.5841814  97276.13 0.2392807
    #> 1978 - 2016 427141.1 174957.0 0.5735868 100353.02 0.2349411
    #>
    #> $add$params
    #>                     r        K    p         c
    #> 1978 - 2019 0.7340582 393745.8 0.25 0.1401940
    #> 1978 - 2018 0.7337487 396766.2 0.25 0.1391139
    #> 1978 - 2017 0.7302268 406535.6 0.25 0.1342291
    #> 1978 - 2016 0.7169834 427141.1 0.25 0.1338208
    #>
    #>
    #> $mult
    #> $mult$BRPs
    #>                    K    B_MSY     F_MSY      MSY  MSYoverK
    #> 1978 - 2019 450802.6 184648.7 0.5477036 101132.8 0.2243394
    #> 1978 - 2018 453630.1 185806.9 0.5491147 102029.3 0.2249174
    #> 1978 - 2017 461292.5 188945.4 0.5508720 104084.7 0.2256372
    #> 1978 - 2016 484226.1 198339.0 0.5423817 107575.4 0.2221595
    #>
    #> $mult$params
    #>                     r        K    p         c
    #> 1978 - 2019 0.6846295 450802.6 0.25 0.1785140
    #> 1978 - 2018 0.6863933 453630.1 0.25 0.1775464
    #> 1978 - 2017 0.6885900 461292.5 0.25 0.1731753
    #> 1978 - 2016 0.6779771 484226.1 0.25 0.1704043
    #> $BRPs
    #>                    K    B_MSY     F_MSY      MSY  MSYoverK
    #> 1978 - 2019 529631.1 216936.9 0.5042717 109395.1 0.2065497
    #> 1978 - 2018 534350.5 218870.0 0.5047717 110479.4 0.2067545
    #> 1978 - 2017 547288.4 224169.3 0.5048596 113174.0 0.2067905
    #> 1978 - 2016 585744.5 239921.0 0.4944368 118625.8 0.2025213
    #> 1978 - 2015 625579.8 256237.5 0.4807142 123177.0 0.1969005
    #> 1978 - 2014 606781.3 248537.6 0.4869952 121036.6 0.1994733
    #>
    #> $params
    #>                     r        K    p
    #> 1978 - 2019 0.6303396 529631.1 0.25
    #> 1978 - 2018 0.6309646 534350.5 0.25
    #> 1978 - 2017 0.6310745 547288.4 0.25
    #> 1978 - 2016 0.6180460 585744.5 0.25
    #> 1978 - 2015 0.6008928 625579.8 0.25
    #> 1978 - 2014 0.6087441 606781.3 0.25

    knobi_retro( hake_n_results, hake_n_multi,
                 yR = c(2005,2010,2015),
                 yR0 = c(1990,1995,1995))

    #> $base
    #> $base$BRPs
    #>                    K     B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019 529631.1 216936.88 0.5042717 109395.12 0.2065497
    #> 1990 - 2005 164718.6  67468.74 0.8630042  58225.81 0.3534865
    #> 1995 - 2010 391203.7 210004.26 0.8258184 173425.39 0.4433122
    #> 1995 - 2015 422793.8 195255.58 0.6960105 135899.92 0.3214331
    #>
    #> $base$params
    #>                     r        K         p
    #> 1978 - 2019 0.6303396 529631.1 0.2500000
    #> 1990 - 2005 1.0787553 164718.6 0.2500000
    #> 1995 - 2010 2.0000000 391203.7 1.4218399
    #> 1995 - 2015 1.1425156 422793.8 0.6415208
    #>
    #>
    #> $add
    #> $add$BRPs
    #>                    K     B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019 516488.3 211553.60 0.5067794 107211.01 0.2075769
    #> 1990 - 2005 111640.1  55621.52 1.0092475  56135.88 0.5028292
    #> 1995 - 2010 405142.5 215900.38 0.8428851 181979.21 0.4491734
    #> 1995 - 2015 456976.9 214188.60 0.7175495 153690.92 0.3363210
    #>
    #> $add$params
    #>                     r        K         p          c1           c2
    #> 1978 - 2019 0.6334743 516488.3 0.2500000  0.01699067 -0.004395079
    #> 1990 - 2005 2.0000000 111640.1 0.9816744 -0.12416757  0.002753431
    #> 1995 - 2010 2.0000000 405142.5 1.3728028 -0.07141606  0.019703123
    #> 1995 - 2015 1.2206167 456976.9 0.7010907 -0.07483213  0.049012357
    #>
    #>
    #> $mult
    #> $mult$BRPs
    #>                    K     B_MSY     F_MSY       MSY  MSYoverK
    #> 1978 - 2019 498824.2 204318.37 0.5217789 106609.01 0.2137206
    #> 1990 - 2005 114444.0  57363.85 0.9936034  56996.92 0.4980331
    #> 1995 - 2010 396365.5 211096.05 0.8442971 178227.79 0.4496551
    #> 1995 - 2015 422155.9 201122.10 0.7438395 149602.56 0.3543776
    #>
    #> $mult$params
    #>                     r        K         p          c1           c2
    #> 1978 - 2019 0.6522236 498824.2 0.2500000  0.05169040 -0.006546061
    #> 1990 - 2005 2.0000000 114444.0 1.0128755 -0.09494592  0.001506820
    #> 1995 - 2010 2.0000000 396365.5 1.3688343 -0.05364248  0.025982666
    #> 1995 - 2015 1.3168214 422155.9 0.7703032 -0.06813650  0.090082468

### 2.4. `knobi_proj`

`knobi_proj` function projects the time series of biomass (or spawning biomass) and then the surplus production for a set of future catch or fishing mortality values.

One of the `knobi_proj` arguments is a data frame containing the selected catch for the projected years. In this case three catch scenarios are considered: (i) constant catch value equal to the last historical catch, (ii) last historical catch with a 20% increase; and (iii) last historical catch with a 20% decrease.

    catch <- rep(hake_n_results$input$Catch[length(hake_n_results$input$Catch)],8)
    C <- data.frame(catch=catch, catch08=0.8*catch, catch12=1.2*catch)

The resulting plots are displayed in the plot window. In this example, four plots are presented in a panel reporting the SSB, surplus production, catch and fishing mortality projections for each catch catch scenario. Note that, in this case, `plot_out = FALSE` (by default), then plots are not saved like in the previous examples.

Then, on the basis of the above catch scenarios and the `hake_n_results` object, the projections are carried out.

    projections <- knobi_proj( knobi_results=hake_n_results, c=C)

#### Quantitative results

Running the name of the output object the data frame with the projections for each scenario are printed. Details of the additional output information are provided in the help page.

    projections
    #>
    #>  Projections:
    #>
    #>       SSB        SP Year        C         F      Sc Model
    #>  235508.2 108904.39 2020  87238.0 0.3704245   catch  base
    #>  256339.7 107234.52 2021  87238.0 0.3403219   catch  base
    #>  275106.4 104775.00 2022  87238.0 0.3171064   catch  base
    #>  291242.7 101973.57 2023  87238.0 0.2995371   catch  base
    #>  304589.9  99196.74 2024  87238.0 0.2864114   catch  base
    #>  315290.2  96680.05 2025  87238.0 0.2766911   catch  base
    #>  323660.2  94535.92 2026  87238.0 0.2695357   catch  base
    #>  330084.1  92787.89 2027  87238.0 0.2642902   catch  base
    #>  243962.5 108365.37 2020  69790.4 0.2860702 catch08  base
    #>  280323.4 103937.23 2021  69790.4 0.2489639 catch08  base
    #>  311323.0  97642.80 2022  69790.4 0.2241736 catch08  base
    #>  335916.5  91124.98 2023  69790.4 0.2077612 catch08  base
    #>  354385.4  85393.72 2024  69790.4 0.1969336 catch08  base
    #>  367707.9  80832.01 2025  69790.4 0.1897985 catch08  base
    #>  377046.9  77426.72 2026  69790.4 0.1850974 catch08  base
    #>  383464.5  74989.39 2027  69790.4 0.1819996 catch08  base
    #>  226957.6 109250.89 2020 104685.6 0.4612561 catch12  base
    #>  231444.6 109094.31 2021 104685.6 0.4523138 catch12  base
    #>  235752.0 108891.56 2022 104685.6 0.4440497 catch12  base
    #>  239838.3 108652.38 2023 104685.6 0.4364840 catch12  base
    #>  243672.5 108387.04 2024 104685.6 0.4296161 catch12  base
    #>  247233.2 108105.55 2025 104685.6 0.4234287 catch12  base
    #>  250508.9 107817.08 2026 104685.6 0.4178918 catch12  base
    #>  253496.6 107529.56 2027 104685.6 0.4129665 catch12  base
    #>
    #>

#### With environmental information

There is the possibility of considering the environmental information in the projections. For this purpose, the `knobi_env` output and the new environmental values for the future years `env` argument must be provided.

In the current example, three scenarios are considered: (i) Constant AMO equal to last year’s AMO; (ii) constant AMO equal to last year’s AMO with a 50% increment; and (iii) constant AMO equal to last year’s AMO with a 50% decrease.

    last_AMO <- Env$AMO[length(Env$AMO)]
    env <- data.frame( AMOi=rep(last_AMO,5),
                       AMOii=rep(last_AMO*1.5,5),
                       AMOiii=rep(last_AMO*0.5,5))

    C <- C[(1:5),]

Note that, as shown below, in this case, in addition to the plot with the results from the base KBPM model, additional plots are provided: (1) panels for each catch or fishing mortality scenario, depending on the model and environmental scenario; and (2) the same information, but now presented by each environmental scenario, depending on the model and catch or fishing mortality.

    env_projections <- knobi_proj(hake_n_results, hake_n_environmental, c=C, env=env)

    env_projections
    #>
    #>  Projections:
    #>
    #>       SSB        SP Year        C         F      Sc Model  EnvSc
    #>  235508.2 108904.39 2020  87238.0 0.3704245   catch  base   <NA>
    #>  256339.7 107234.52 2021  87238.0 0.3403219   catch  base   <NA>
    #>  275106.4 104775.00 2022  87238.0 0.3171064   catch  base   <NA>
    #>  291242.7 101973.57 2023  87238.0 0.2995371   catch  base   <NA>
    #>  304589.9  99196.74 2024  87238.0 0.2864114   catch  base   <NA>
    #>  243962.5 108365.37 2020  69790.4 0.2860702 catch08  base   <NA>
    #>  280323.4 103937.23 2021  69790.4 0.2489639 catch08  base   <NA>
    #>  311323.0  97642.80 2022  69790.4 0.2241736 catch08  base   <NA>
    #>  335916.5  91124.98 2023  69790.4 0.2077612 catch08  base   <NA>
    #>  354385.4  85393.72 2024  69790.4 0.1969336 catch08  base   <NA>
    #>  226957.6 109250.89 2020 104685.6 0.4612561 catch12  base   <NA>
    #>  231444.6 109094.31 2021 104685.6 0.4523138 catch12  base   <NA>
    #>  235752.0 108891.56 2022 104685.6 0.4440497 catch12  base   <NA>
    #>  239838.3 108652.38 2023 104685.6 0.4364840 catch12  base   <NA>
    #>  243672.5 108387.04 2024 104685.6 0.4296161 catch12  base   <NA>
    #>  236966.1 111820.26 2020  87238.0 0.3681454   catch   add   AMOi
    #>  259385.4 107494.21 2021  87238.0 0.3363258   catch   add   AMOi
    #>  277361.0 102932.98 2022  87238.0 0.3145288   catch   add   AMOi
    #>  291014.8  98850.79 2023  87238.0 0.2997717   catch   add   AMOi
    #>  300976.4  95548.33 2024  87238.0 0.2898500   catch   add   AMOi
    #>  237731.7 113351.45 2020  87238.0 0.3669599   catch  mult   AMOi
    #>  260930.8 107522.69 2021  87238.0 0.3343339   catch  mult   AMOi
    #>  278416.0 101923.73 2022  87238.0 0.3133369   catch  mult   AMOi
    #>  290817.4  97355.01 2023  87238.0 0.2999752   catch  mult   AMOi
    #>  299245.2  93976.58 2024  87238.0 0.2915268   catch  mult   AMOi
    #>  242182.5 122252.96 2020  87238.0 0.3602160   catch   add  AMOii
    #>  274466.6 116791.25 2021  87238.0 0.3178456   catch   add  AMOii
    #>  300716.5 110184.67 2022  87238.0 0.2901004   catch   add  AMOii
    #>  320564.0 103986.24 2023  87238.0 0.2721391   catch   add  AMOii
    #>  334787.8  98937.37 2024  87238.0 0.2605770   catch   add  AMOii
    #>  241313.5 120514.92 2020  87238.0 0.3615132   catch  mult  AMOii
    #>  270340.1 112014.39 2021  87238.0 0.3226972   catch  mult  AMOii
    #>  291150.7 104082.83 2022  87238.0 0.2996317   catch  mult  AMOii
    #>  304963.5  98018.79 2023  87238.0 0.2860604   catch  mult  AMOii
    #>  313674.2  93878.53 2024  87238.0 0.2781166   catch  mult  AMOii
    #>  231709.1 101306.10 2020  87238.0 0.3764980   catch   add AMOiii
    #>  244400.1  98551.91 2021  87238.0 0.3569475   catch   add AMOiii
    #>  254440.6  96005.27 2022  87238.0 0.3428619   catch   add AMOiii
    #>  262126.8  93842.97 2023  87238.0 0.3328084   catch   add AMOiii
    #>  267865.7  92110.84 2024  87238.0 0.3256782   catch   add AMOiii
    #>  234322.8 106533.57 2020  87238.0 0.3722984   catch  mult AMOiii
    #>  251752.5 102801.95 2021  87238.0 0.3465228   catch  mult AMOiii
    #>  265497.4  99163.77 2022  87238.0 0.3285832   catch  mult AMOiii
    #>  275857.4  96032.30 2023  87238.0 0.3162431   catch  mult AMOiii
    #>  283408.2  93545.29 2024  87238.0 0.3078174   catch  mult AMOiii
    #>  244521.6 109483.58 2020  69790.4 0.2854161 catch08   add   AMOi
    #>  280033.9 101121.77 2021  69790.4 0.2492213 catch08   add   AMOi
    #>  306990.4  92372.18 2022  69790.4 0.2273374 catch08   add   AMOi
    #>  325922.4  85072.58 2023  69790.4 0.2141319 catch08   add   AMOi
    #>  338523.4  79710.15 2024  69790.4 0.2061612 catch08   add   AMOi
    #>  245575.5 111591.48 2020  69790.4 0.2841912 catch08  mult   AMOi
    #>  281921.7 100681.57 2021  69790.4 0.2475525 catch08  mult   AMOi
    #>  307664.9  90385.73 2022  69790.4 0.2268390 catch08  mult   AMOi
    #>  324384.2  82633.61 2023  69790.4 0.2151474 catch08  mult   AMOi
    #>  334648.6  77476.00 2024  69790.4 0.2085483 catch08  mult   AMOi
    #>  249681.6 119803.61 2020  69790.4 0.2795176 catch08   add  AMOii
    #>  294961.1 110336.25 2021  69790.4 0.2366088 catch08   add  AMOii
    #>  329963.8  99249.79 2022  69790.4 0.2115093 catch08   add  AMOii
    #>  354614.8  89633.05 2023  69790.4 0.1968062 catch08   add  AMOii
    #>  370894.6  82507.41 2024  69790.4 0.1881677 catch08   add  AMOii
    #>  249055.5 118551.39 2020  69790.4 0.2802203 catch08  mult  AMOii
    #>  290680.0 104278.44 2021  69790.4 0.2400936 catch08  mult  AMOii
    #>  318715.4  91373.17 2022  69790.4 0.2189740 catch08  mult  AMOii
    #>  335770.4  82317.66 2023  69790.4 0.2078515 catch08  mult  AMOii
    #>  345514.8  76751.82 2024  69790.4 0.2019896 catch08  mult  AMOii
    #>  239323.1  99086.58 2020  69790.4 0.2916158 catch08   add AMOiii
    #>  265221.4  92290.92 2021  69790.4 0.2631401 catch08   add AMOiii
    #>  284525.6  85898.18 2022  69790.4 0.2452869 catch08   add AMOiii
    #>  298070.1  80771.74 2023  69790.4 0.2341409 catch08   add AMOiii
    #>  307183.4  77035.62 2024  69790.4 0.2271946 catch08   add AMOiii
    #>  242259.6 104959.52 2020  69790.4 0.2880811 catch08  mult AMOiii
    #>  273357.8  96817.84 2021  69790.4 0.2553078 catch08  mult AMOiii
    #>  296410.9  88869.15 2022  69790.4 0.2354515 catch08  mult AMOiii
    #>  312304.2  82498.12 2023  69790.4 0.2234693 catch08  mult AMOiii
    #>  322732.2  77938.71 2024  69790.4 0.2162486 catch08  mult AMOiii
    #>  229324.9 113985.40 2020 104685.6 0.4564947 catch12   add   AMOi
    #>  237987.3 112710.65 2021 104685.6 0.4398789 catch12   add   AMOi
    #>  245374.1 111434.00 2022 104685.6 0.4266368 catch12   add   AMOi
    #>  251525.8 110240.62 2023 104685.6 0.4162023 catch12   add   AMOi
    #>  256550.4 109179.75 2024 104685.6 0.4080509 catch12   add   AMOi
    #>  229786.0 114907.59 2020 104685.6 0.4555787 catch12  mult   AMOi
    #>  239085.9 113063.33 2021 104685.6 0.4378578 catch12  mult   AMOi
    #>  246604.2 111344.48 2022 104685.6 0.4245086 catch12  mult   AMOi
    #>  252517.2 109852.80 2023 104685.6 0.4145682 catch12  mult   AMOi
    #>  257069.1 108622.15 2024 104685.6 0.4072275 catch12  mult   AMOi
    #>  234600.9 124537.38 2020 104685.6 0.4462285 catch12   add  AMOii
    #>  253273.1 122178.29 2021 104685.6 0.4133309 catch12   add  AMOii
    #>  269335.1 119316.86 2022 104685.6 0.3886816 catch12   add  AMOii
    #>  282517.6 116419.36 2023 104685.6 0.3705454 catch12   add  AMOii
    #>  292937.4 113791.32 2024 104685.6 0.3573651 catch12   add  AMOii
    #>  233467.6 122270.85 2020 104685.6 0.4483945 catch12  mult  AMOii
    #>  249176.9 118518.81 2021 104685.6 0.4201257 catch12  mult  AMOii
    #>  261253.4 115005.47 2022 104685.6 0.4007052 catch12  mult  AMOii
    #>  270116.3 112091.57 2023 104685.6 0.3875575 catch12  mult  AMOii
    #>  276404.6 109856.29 2024 104685.6 0.3787404 catch12  mult  AMOii
    #>  224005.7 103346.99 2020 104685.6 0.4673345 catch12   add AMOiii
    #>  222770.7 103554.32 2021 104685.6 0.4699253 catch12   add AMOiii
    #>  221725.2 103725.76 2022 104685.6 0.4721412 catch12   add AMOiii
    #>  220836.7 103868.47 2023 104685.6 0.4740408 catch12   add AMOiii
    #>  220079.3 103987.96 2024 104685.6 0.4756722 catch12   add AMOiii
    #>  226286.4 107908.36 2020 104685.6 0.4626244 catch12  mult AMOiii
    #>  229267.2 107424.50 2021 104685.6 0.4566096 catch12  mult AMOiii
    #>  231789.4 106991.02 2022 104685.6 0.4516411 catch12  mult AMOiii
    #>  233904.6 106610.60 2023 104685.6 0.4475569 catch12  mult AMOiii
    #>  235665.4 106282.25 2024 104685.6 0.4442128 catch12  mult AMOiii
    #>
    #>

The output list also contains the projections for each of the scenarios catches and environmental scenarios. Details of the output are available in the help page.

#### Forecast via fishing mortality

Alternatively, projections can be based on fishing mortality. The scenarios presented below have been created from the estimated Fmsy in the `knobi_fit` analysis.

    fmsy <- hake_n_results$BRPs['F_MSY']
    ff <- rep(fmsy,5)
    f <- data.frame( f=ff, f12=ff*1.2, f08=ff*0.8)

    f_projections <- knobi_proj( hake_n_results, f=f, env_results=hake_n_environmental, env=env)

    f_projections
    #>
    #>  Projections:
    #>
    #>       SSB        SP Year         C         F  Sc Model  EnvSc
    #>  223095.0 109340.41 2020 112500.47 0.5042717   f  base   <NA>
    #>  220585.4 109375.86 2021 111234.96 0.5042717   f  base   <NA>
    #>  219105.6 109388.31 2022 110488.75 0.5042717   f  base   <NA>
    #>  218228.5 109392.70 2023 110046.46 0.5042717   f  base   <NA>
    #>  217707.0 109394.26 2024 109783.48 0.5042717   f  base   <NA>
    #>  214475.7 109386.30 2020 129784.84 0.6051260 f12  base   <NA>
    #>  198627.8 108897.43 2021 120194.82 0.6051260 f12  base   <NA>
    #>  189718.7 108283.08 2022 114803.74 0.6051260 f12  base   <NA>
    #>  184530.5 107808.37 2023 111664.20 0.6051260 f12  base   <NA>
    #>  181445.9 107484.40 2024 109797.66 0.6051260 f12  base   <NA>
    #>  232338.5 109056.43 2020  93729.39 0.4034173 f08  base   <NA>
    #>  244779.5 108303.12 2021  98748.28 0.4034173 f08  base   <NA>
    #>  252451.6 107632.75 2022 101843.35 0.4034173 f08  base   <NA>
    #>  257070.6 107155.32 2023 103706.73 0.4034173 f08  base   <NA>
    #>  259811.7 106846.13 2024 104812.53 0.4034173 f08  base   <NA>
    #>  225365.8 115027.26 2020 113645.60 0.5042717   f   add   AMOi
    #>  226430.5 114930.05 2021 114182.46 0.5042717   f   add   AMOi
    #>  227005.9 114875.95 2022 114472.64 0.5042717   f   add   AMOi
    #>  227316.2 114846.32 2023 114629.10 0.5042717   f   add   AMOi
    #>  227483.2 114830.23 2024 114713.34 0.5042717   f   add   AMOi
    #>  225607.5 115632.43 2020 113767.46 0.5042717   f  mult   AMOi
    #>  227003.1 115397.58 2021 114471.25 0.5042717   f  mult   AMOi
    #>  227695.3 115278.40 2022 114820.31 0.5042717   f  mult   AMOi
    #>  228037.4 115218.84 2023 114992.80 0.5042717   f  mult   AMOi
    #>  228206.1 115189.30 2024 115077.89 0.5042717   f  mult   AMOi
    #>  229710.1 125906.52 2020 115836.30 0.5042717   f   add  AMOii
    #>  237587.7 125493.67 2021 119808.74 0.5042717   f   add  AMOii
    #>  242001.6 125177.39 2022 122034.54 0.5042717   f   add  AMOii
    #>  244431.8 124977.61 2023 123260.03 0.5042717   f   add  AMOii
    #>  245757.0 124861.07 2024 123928.28 0.5042717   f   add  AMOii
    #>  228641.9 123231.38 2020 115297.62 0.5042717   f  mult  AMOii
    #>  234507.1 122051.95 2021 118255.28 0.5042717   f  mult  AMOii
    #>  237296.4 121443.74 2022 119661.84 0.5042717   f  mult  AMOii
    #>  238601.7 121148.75 2023 120320.06 0.5042717   f  mult  AMOii
    #>  239207.9 121009.51 2024 120625.76 0.5042717   f  mult  AMOii
    #>  220997.2 104087.02 2020 111442.62 0.5042717   f   add AMOiii
    #>  215416.2 104821.99 2021 108628.30 0.5042717   f   add AMOiii
    #>  212511.8 105161.11 2022 107163.68 0.5042717   f   add AMOiii
    #>  210979.1 105327.96 2023 106390.78 0.5042717   f   add AMOiii
    #>  210164.3 105413.22 2024 105979.92 0.5042717   f   add AMOiii
    #>  222737.0 108443.90 2020 112319.95 0.5042717   f  mult AMOiii
    #>  219804.7 108852.68 2021 110841.26 0.5042717   f  mult AMOiii
    #>  218295.7 109051.05 2022 110080.35 0.5042717   f  mult AMOiii
    #>  217513.5 109150.67 2023 109685.88 0.5042717   f  mult AMOiii
    #>  217106.4 109201.64 2024 109480.60 0.5042717   f  mult AMOiii
    #>  217382.4 116958.55 2020 131543.74 0.6051260 f12   add   AMOi
    #>  206343.6 117371.48 2021 124863.88 0.6051260 f12   add   AMOi
    #>  200608.7 117416.08 2022 121393.53 0.6051260 f12   add   AMOi
    #>  197545.5 117391.13 2023 119539.95 0.6051260 f12   add   AMOi
    #>  195885.1 117363.22 2024 118535.20 0.6051260 f12   add   AMOi
    #>  217348.9 116871.18 2020 131523.45 0.6051260 f12  mult   AMOi
    #>  206568.1 118090.41 2021 124999.71 0.6051260 f12  mult   AMOi
    #>  201424.3 118508.81 2022 121887.07 0.6051260 f12  mult   AMOi
    #>  198894.5 118674.99 2023 120356.25 0.6051260 f12  mult   AMOi
    #>  197631.8 118748.07 2024 119592.17 0.6051260 f12  mult   AMOi
    #>  221616.2 127988.24 2020 134105.75 0.6051260 f12   add  AMOii
    #>  216915.2 127976.41 2021 131261.02 0.6051260 f12   add  AMOii
    #>  214379.3 127939.45 2022 129726.52 0.6051260 f12   add  AMOii
    #>  212996.1 127910.17 2023 128889.51 0.6051260 f12   add  AMOii
    #>  212237.1 127891.35 2024 128430.17 0.6051260 f12   add  AMOii
    #>  220340.9 124665.80 2020 133334.01 0.6051260 f12  mult  AMOii
    #>  214032.3 125567.65 2021 129516.54 0.6051260 f12  mult  AMOii
    #>  211138.2 125925.87 2022 127765.23 0.6051260 f12  mult  AMOii
    #>  209785.7 126081.16 2023 126946.80 0.6051260 f12  mult  AMOii
    #>  209148.2 126151.66 2024 126561.03 0.6051260 f12  mult  AMOii
    #>  213125.4 105868.55 2020 128967.73 0.6051260 f12   add AMOiii
    #>  195912.8 107226.00 2021 118551.96 0.6051260 f12   add AMOiii
    #>  187318.2 107487.70 2022 113351.10 0.6051260 f12   add AMOiii
    #>  182825.2 107509.83 2023 110632.30 0.6051260 f12   add AMOiii
    #>  180419.9 107488.64 2024 109176.79 0.6051260 f12   add AMOiii
    #>  214523.6 109511.04 2020 129813.81 0.6051260 f12  mult AMOiii
    #>  199441.1 110824.87 2021 120687.02 0.6051260 f12  mult AMOiii
    #>  191995.9 111153.50 2022 116181.74 0.6051260 f12  mult AMOiii
    #>  188167.9 111237.38 2023 113865.28 0.6051260 f12  mult AMOiii
    #>  186158.3 111257.88 2024 112649.21 0.6051260 f12  mult AMOiii
    #>  233864.3 112723.46 2020  94344.90 0.4034173 f08   add   AMOi
    #>  248279.4 110611.80 2021 100160.20 0.4034173 f08   add   AMOi
    #>  256365.9 109143.81 2022 103422.43 0.4034173 f08   add   AMOi
    #>  260760.4 108262.89 2023 105195.25 0.4034173 f08   add   AMOi
    #>  263107.5 107768.74 2024 106142.12 0.4034173 f08   add   AMOi
    #>  234408.1 114030.46 2020  94564.28 0.4034173 f08  mult   AMOi
    #>  249220.9 110699.39 2021 100540.01 0.4034173 f08  mult   AMOi
    #>  256837.5 108686.48 2022 103612.68 0.4034173 f08  mult   AMOi
    #>  260613.7 107614.86 2023 105136.10 0.4034173 f08  mult   AMOi
    #>  262452.1 107075.74 2024 105877.73 0.4034173 f08  mult   AMOi
    #>  238323.2 123440.19 2020  96143.72 0.4034173 f08   add  AMOii
    #>  260056.0 121080.27 2021 104911.11 0.4034173 f08   add  AMOii
    #>  272675.6 119072.08 2022 110002.07 0.4034173 f08   add  AMOii
    #>  279678.7 117763.31 2023 112827.22 0.4034173 f08   add  AMOii
    #>  283468.0 116998.51 2024 114355.91 0.4034173 f08   add  AMOii
    #>  237475.8 121403.57 2020  95801.87 0.4034173 f08  mult  AMOii
    #>  256695.9 116394.08 2021 103555.59 0.4034173 f08  mult  AMOii
    #>  266146.7 113431.22 2022 107368.19 0.4034173 f08  mult  AMOii
    #>  270569.5 111935.08 2023 109152.44 0.4034173 f08  mult  AMOii
    #>  272591.0 111228.34 2024 109967.95 0.4034173 f08  mult  AMOii
    #>  229379.7 101945.17 2020  92535.75 0.4034173 f08   add AMOiii
    #>  236647.7 100594.46 2021  95467.80 0.4034173 f08   add AMOiii
    #>  240579.6  99791.03 2022  97053.98 0.4034173 f08   add AMOiii
    #>  242670.9  99343.19 2023  97897.65 0.4034173 f08   add AMOiii
    #>  243773.2  99101.45 2024  98342.34 0.4034173 f08   add AMOiii
    #>  231500.3 107041.82 2020  93391.23 0.4034173 f08  mult AMOiii
    #>  242014.7 105011.23 2021  97632.94 0.4034173 f08  mult AMOiii
    #>  247639.4 103773.05 2022  99902.02 0.4034173 f08  mult AMOiii
    #>  250574.7 103085.66 2023 101086.16 0.4034173 f08  mult AMOiii
    #>  252086.7 102720.65 2024 101696.13 0.4034173 f08  mult AMOiii
    #>
    #>

#### Case of considering multicovariate environmental models

In case of `multicovar=TRUE` in `knobi_env`, the `env` argument must be a list in which each item is a data frame containing the values of the variables for a specific environmental scenario. In the following scenario we have two scenarios, “climate_1” and “climate_2”, and each of them we provide values of the two covariables, “AMO” and “NAO”, which are the ones included in the environmental fit.

    env <- list( climate_1 = data.frame( AMO=c(0.2,0.2,0.3,0.3,0.4),
                                         NAO=c(0.2,0.2,0.3,0.3,0.4)),
                 climate_2 = data.frame( AMO=c(0.2,0.3,0.4,0.5,0.6),
                                         NAO=c(0.2,0.3,0.4,0.5,0.6)))

    multiproj <- knobi_proj( hake_n_results, hake_n_multi, c=C, env=env)

    multiproj
    #>
    #>  Projections:
    #>
    #>       SSB        SP Year        C         F      Sc Model     EnvSc
    #>  235508.2 108904.39 2020  87238.0 0.3704245   catch  base      <NA>
    #>  256339.7 107234.52 2021  87238.0 0.3403219   catch  base      <NA>
    #>  275106.4 104775.00 2022  87238.0 0.3171064   catch  base      <NA>
    #>  291242.7 101973.57 2023  87238.0 0.2995371   catch  base      <NA>
    #>  304589.9  99196.74 2024  87238.0 0.2864114   catch  base      <NA>
    #>  243962.5 108365.37 2020  69790.4 0.2860702 catch08  base      <NA>
    #>  280323.4 103937.23 2021  69790.4 0.2489639 catch08  base      <NA>
    #>  311323.0  97642.80 2022  69790.4 0.2241736 catch08  base      <NA>
    #>  335916.5  91124.98 2023  69790.4 0.2077612 catch08  base      <NA>
    #>  354385.4  85393.72 2024  69790.4 0.1969336 catch08  base      <NA>
    #>  226957.6 109250.89 2020 104685.6 0.4612561 catch12  base      <NA>
    #>  231444.6 109094.31 2021 104685.6 0.4523138 catch12  base      <NA>
    #>  235752.0 108891.56 2022 104685.6 0.4440497 catch12  base      <NA>
    #>  239838.3 108652.38 2023 104685.6 0.4364840 catch12  base      <NA>
    #>  243672.5 108387.04 2024 104685.6 0.4296161 catch12  base      <NA>
    #>  236170.3 110228.58 2020  87238.0 0.3693860   catch   add climate_1
    #>  258251.3 108409.50 2021  87238.0 0.3378027   catch   add climate_1
    #>  279117.2 107798.15 2022  87238.0 0.3125498   catch   add climate_1
    #>  298011.7 104466.99 2023  87238.0 0.2927334   catch   add climate_1
    #>  314709.1 103403.73 2024  87238.0 0.2772020   catch   add climate_1
    #>  236426.6 110741.14 2020  87238.0 0.3689856   catch  mult climate_1
    #>  258446.6 107774.90 2021  87238.0 0.3375475   catch  mult climate_1
    #>  278431.0 106669.89 2022  87238.0 0.3133200   catch  mult climate_1
    #>  295699.9 102343.91 2023  87238.0 0.2950221   catch  mult climate_1
    #>  310025.1 100782.52 2024  87238.0 0.2813901   catch  mult climate_1
    #>  236170.3 110228.58 2020  87238.0 0.3693860   catch   add climate_2
    #>  259234.8 110376.43 2021  87238.0 0.3365212   catch   add climate_2
    #>  281989.1 109608.18 2022  87238.0 0.3093666   catch   add climate_2
    #>  303659.7 108209.03 2023  87238.0 0.2872887   catch   add climate_2
    #>  323771.2 106489.99 2024  87238.0 0.2694433   catch   add climate_2
    #>  236426.6 110741.14 2020  87238.0 0.3689856   catch  mult climate_2
    #>  259771.3 110424.25 2021  87238.0 0.3358262   catch  mult climate_2
    #>  282070.9 108651.00 2022  87238.0 0.3092769   catch  mult climate_2
    #>  302143.0 105969.12 2023  87238.0 0.2887309   catch  mult climate_2
    #>  319378.3 102977.49 2024  87238.0 0.2731495   catch  mult climate_2
    #>  244549.9 109540.21 2020  69790.4 0.2853831 catch08   add climate_1
    #>  281987.2 104915.10 2021  69790.4 0.2474950 catch08   add climate_1
    #>  314937.4 100566.12 2022  69790.4 0.2216009 catch08   add climate_1
    #>  342108.4  93356.76 2023  69790.4 0.2040008 catch08   add climate_1
    #>  363737.0  89481.26 2024  69790.4 0.1918705 catch08   add climate_1
    #>  244677.7 109795.78 2020  69790.4 0.2852340 catch08  mult climate_1
    #>  281398.6 103226.78 2021  69790.4 0.2480126 catch08  mult climate_1
    #>  311994.1  97545.08 2022  69790.4 0.2236914 catch08  mult climate_1
    #>  335670.3  89388.21 2023  69790.4 0.2079135 catch08  mult climate_1
    #>  352967.2  84786.32 2024  69790.4 0.1977249 catch08  mult climate_1
    #>  244549.9 109540.21 2020  69790.4 0.2853831 catch08   add climate_2
    #>  283008.8 106958.39 2021  69790.4 0.2466015 catch08   add climate_2
    #>  317887.3 102379.33 2022  69790.4 0.2195445 catch08   add climate_2
    #>  347889.7  97206.41 2023  69790.4 0.2006107 catch08   add climate_2
    #>  372907.4  92409.73 2024  69790.4 0.1871521 catch08   add climate_2
    #>  244677.7 109795.78 2020  69790.4 0.2852340 catch08  mult climate_2
    #>  282631.0 105691.56 2021  69790.4 0.2469312 catch08  mult climate_2
    #>  315230.8  99088.94 2022  69790.4 0.2213946 catch08  mult climate_2
    #>  341026.6  92083.34 2023  69790.4 0.2046480 catch08  mult climate_2
    #>  360292.7  86029.78 2024  69790.4 0.1937047 catch08  mult climate_2
    #>  227696.1 110727.79 2020 104685.6 0.4597602 catch12   add climate_1
    #>  233626.6 110504.35 2021 104685.6 0.4480895 catch12   add climate_1
    #>  240255.2 112124.16 2022 104685.6 0.4357266 catch12   add climate_1
    #>  247459.8 111656.13 2023 104685.6 0.4230409 catch12   add climate_1
    #>  255153.2 113102.04 2024 104685.6 0.4102852 catch12   add climate_1
    #>  228076.5 111488.67 2020 104685.6 0.4589933 catch12  mult climate_1
    #>  234596.8 110923.14 2021 104685.6 0.4462362 catch12  mult climate_1
    #>  241911.1 113076.65 2022 104685.6 0.4327440 catch12  mult climate_1
    #>  249776.5 112025.18 2023 104685.6 0.4191172 catch12  mult climate_1
    #>  257950.9 113694.96 2024 104685.6 0.4058353 catch12  mult climate_1
    #>  227696.1 110727.79 2020 104685.6 0.4597602 catch12   add climate_2
    #>  234571.9 112395.10 2021 104685.6 0.4462836 catch12   add climate_2
    #>  243059.0 113950.13 2022 104685.6 0.4307004 catch12   add climate_2
    #>  253018.3 115339.81 2023 104685.6 0.4137471 catch12   add climate_2
    #>  264259.6 116514.00 2024 104685.6 0.3961468 catch12   add climate_2
    #>  228076.5 111488.67 2020 104685.6 0.4589933 catch12  mult climate_2
    #>  236006.5 113742.47 2021 104685.6 0.4435708 catch12  mult climate_2
    #>  245973.5 115562.80 2022 104685.6 0.4255970 catch12  mult climate_2
    #>  257477.2 116815.65 2023 104685.6 0.4065821 catch12  mult climate_2
    #>  269915.5 117432.13 2024 104685.6 0.3878459 catch12  mult climate_2
    #>
    #>

## References

Schaefer, M.B. (1954). Some Aspects of the Dynamics of Populations Important to the Management of the Commercial Marine Fisheries. Bulletin of the Inter-American Tropical Tuna Commission. 1:26-56.

Pella, J.J., Tomlinson, P.K. (1969). A generalized stock-production model. Bulletin of the Inter-American Tropical Tuna Commission. 13:421–58.

MacCall, A. (2002). Use of Known-Biomass Production Models to Determine Productivity of West Coast Groundfish Stocks. North American Journal of Fisheries Management, 22, 272-279.