Open Ovec8hkin opened 8 months ago
below is an example that should work
library(SpatialSablefishAssessment)
data = list()
data$n_years = 20
data$n_surveys = 2
data$srv_sel_by_year_indicator = matrix(0, nrow = data$n_years, ncol = data$n_surveys)
data$srv_sel_by_year_indicator[10:20,1] = 1
data$srv_sel_type = matrix(0, nrow = length(unique(as.numeric(data$srv_sel_by_year_indicator))), ncol = data$n_surveys)
data$srv_sel_type[,1] = 2 # power selectivity
data$srv_sel_type[,2] = 0 # logistic for both time block 1 and time block 2
## you will need to specify two time-blocks for both selectivities
## in the parameter object
parameters = list()
parameters$ln_srv_sel_pars = array(0, dim =c(2,2,2,2))
na_map = list()
## turn off all the parameters for the single time-block single parameter
## selectivity
## add an additional time-block
## test fix-pars on 3D arrays
data$srv_sel_type = matrix(0,nrow = 2, ncol = data$n_surveys)
data$srv_sel_by_year_indicator[5:length(data$srv_sel_by_year_indicator[,1]),1] = 1
parameters$ln_srv_sel_pars = aperm(array(parameters$ln_srv_sel_pars, dim = c(2,2,2,2)))
## turn off the male and femal parameter for the second time-block
## turn off the second parameter for the first both surveys that we are forced to
## have due to the array structure
vals_to_exclude = rbind(c(2,1,1,1), c(2,1,2,1),c(1,2,1,1), c(1,2,2,1),c(2,2,1,1), c(2,2,2,1)) # dimension is time-block x selectivity par x sex x n_survey
na_map = fix_pars(par_list = parameters, pars_to_exclude = c("ln_srv_sel_pars"),
array_elements_to_exclude = list(ln_srv_sel_pars = vals_to_exclude))
In a scenario where there is more than 1 survey operating, and each survey has a different selectivity type, how should users go about specifying parameters like
ln_srv_sel_pars
where the parameter array dimensions are conditional on the selectivity type?I am running into an issue where my first survey has multiple time blocks and a selectivity type that requires 2 parameters, while my second survey has a single time block and a selectivity type that requires 1 parameter. How should this parameter array, and similar data and parameter structures be setup, and has the
TagIntegrated
model been tested against such scenarios?@Craig44