## Index selectivity

Next, we can move on to index selectivity. Unlike fleet selectivity, selectivity is unique to each index and no dummy fleets are used.

### Is index selectivity already defined elsewhere?

The vector s_selectivity defines where the index selectivity is defined (the terms index and survey are used interchangeably). Index selectivity may be identical to fleet selectivity, i.e., vulnerable biomass, or could be related to spawning or total biomass. If we have 4 surveys with:

s_selectivity <- c("SSB", "B", 1, 2)

The first index is an index of spawning biomass as denoted by “SSB” (maturity is configured in the OM), the second index tracks total biomass as denoted by “B” (selectivity = 1 for all ages), and the third and fourth indices have the selectivity of the first and second fleets, respectively. Integers for fleets refer to the true fleet and not to selectivity blocks/dummy fleets.

No further consideration of survey selectivity is needed when defined elsewhere, and the RCM function call can look like this:

output <- RCM(OM, RCMdata, selectivity = selectivity,
s_selectivity = s_selectivity, ...)

### Index selectivity is independent of anything else in the model

On the other hand, if survey selectivity needs to be explicitly defined, then the s_selectivity vector can indicate the functional form, using one of logistic, dome, or free. Let’s look at another situation with 5 surveys:

s_selectivity <- c(2, "SSB", "B", "dome", "free")

For the fourth and fifth surveys, the selectivity functions are dome-shaped and free parameters, respectively. We will need to consider what the parameters defining this functions are, either as starting values to be estimated or fixed values in the model.

#### Selectivity parameters

Just as with the fleet selectivity parameters, the index selectivity parameters by default use OM@LFS, OM@L5, and OM@Vmaxlen for start values when s_selectivity = "logistic" or "dome". Custom start values are needed when index selectivity uses free parameters.

Custom start values are passed to the RCM in the ivul_par matrix with the same layout as for vul_par:

OM@maxage <- 6
s_selectivity <- c(2, "SSB", "B", "dome", "free")
s_vul_par
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    0    0 55.0    1
## [2,]    0    0    0 40.0    0
## [3,]    0    0    0  0.5    0
## [4,]    0    0    0  0.0    0
## [5,]    0    0    0  0.0    0
## [6,]    0    0    0  0.0    0

Parameter slots for surveys 1 - 3 are ignored. Again they’re placeholders for internal organization. The first three rows in column four are the start values for the three parameters of the dome function (to be estimated), and the fifth survey only selects age-1 animals, i.e., a survey of recruits.

Finally, to remove parameters from estimation either because they’re just placeholders (surveys 1-4) or they should be fixed in the model (survey 5), we provide the map argument for ivul_par with map_ivul_par:

map_ivul_par
##      [,1] [,2] [,3] [,4] [,5]
## [1,]   NA   NA   NA    1   NA
## [2,]   NA   NA   NA    2   NA
## [3,]   NA   NA   NA    3   NA
## [4,]   NA   NA   NA   NA   NA
## [5,]   NA   NA   NA   NA   NA
## [6,]   NA   NA   NA   NA   NA

A function call utilizing this custom set-up for survey selectivity would be:

output <- RCM(OM, data,
selectivity = selectivity, s_selectivity = s_selectivity,
ivul_par = ivul_par, map_ivul_par = map_ivul_par, ...)