seacode / gmacs

A generic size-structured stock assessment model
https://seacode.github.io/gmacs
18 stars 14 forks source link

How to deal with Selectivity #144

Closed quantifish closed 9 years ago

quantifish commented 9 years ago

OK, I need to come up with a way to deal with selectivity in the control file. This approach needs to include the following additional features:

I've taken a look at iSCAM, the NZ rock lobster model and what we have in place currently and had a think about how this could look, this is my first go at it so I am happy to take any suggestions at all over the next couple of days. What e used to have was this:

## ———————————————————————————————————————————————————————————————————————————————————— ##
##        sel   sel  sel sex  size   year  phz                       start  end         ##
## Index  type  mu   sd  dep  nodes  nodes mirror lam1  lam2  lam3 | block  block       ##
## ———————————————————————————————————————————————————————————————————————————————————— ##
## Selectivity P(capture of all sizes)
   1      3    100  120  0    1      1    -1      12.5  12.5  12.5   1975   2014
   2      3    110  150  0    1      1     4      12.5  12.5  12.5   1975   2014 
   3      3     60   65  0    1      1    -3      12.5  12.5  12.5   1975   1981
   3      3     60   65  0    1      1    -3      12.5  12.5  12.5   1982   2014
   4      3     70   90  0    1      1    -4      12.5  12.5  12.5   1975   2014
## ———————————————————————————————————————————————————————————————————————————————————— ##

and what I am proposing is this

## ———————————————————————————————————————————————————————————————————————————————————— ##
## gear  par   sel  sel          prior prior prior phz    start  end                    ##
## index index type par sex init type  mu    sd    mirror block  block                  ##
## ———————————————————————————————————————————————————————————————————————————————————— ##
## Selectivity P(capture of all sizes)
   1     1     3    1   1   100  0     10    200    3     1975   2014
   1     2     3    2   1   120  0     10    200    3     1975   2014
   1     3     3    1   2   100  0     10    200    4     1975   2014
   1     4     3    2   2   120  0     10    200    4     1975   2014
   2     5     3    1   1   110  0     10    200    3     1975   2014
   2     6     3    2   1   150  0     10    200    3     1975   2014
   2     7     3    1   2   110  0     10    200   -5     1975   2014
   2     8     3    2   2   150  0     10    200   -6     1975   2014
   3     9     3    1   1   60   0      5    100    3     1975   1981
   3     10    3    2   1   65   0      5    100    3     1975   1981
   3     11    3    1   1   60   0      5    100    3     1982   2014
   3     12    3    2   1   65   0      5    100    3     1982   2014
   3     13    3    1   2   60   0      5    100   -9     1975   1981
   3     14    3    2   2   65   0      5    100  -10     1975   1981
   3     15    3    1   2   60   0      5    100  -11     1982   2014
   3     16    3    2   2   65   0      5    100  -12     1982   2014
   4     17    4    1   1   10   0      1     50    3     1975   2014
   4     18    4    2   1   50   0     10    100    3     1975   2014
   4     19    4    3   1   75   0     10    200    3     1975   2014
   4     20    4    1   2   10   0      1     50  -17     1975   2014
   4     21    4    2   2   50   0     10    100  -18     1975   2014
   4     22    4    3   2   75   0     10    200  -19     1975   2014
## ———————————————————————————————————————————————————————————————————————————————————— ##

So this proposed way forward specifies a parameter per line, and a sex on a different line. I have retained the mirror concept that Steve came up with as I think it is very useful. I'll walk through this - from the left to the right column we have the gear index, a par index (every parameter gets a different index), a sel type (all the usual suspects, but I will add double normal as option 4), sel par (each of the parameters of the selectivity function selected, e.g. logistic95 has two parameters), sex, prior type, prior mu (or just the first par if say a uniform is used), prior sd, phz mirror (this either species a phase for estimation, or mirrors any of the unique par index), start block and end block.

So above the first gear type is sex-specific (e.g. no phz mirror is used) and is logistic95; the second gear type is not sex-specific (e.g. the phz mirror is pointing at the pars -5 and -6 for the females, which are the male pars), gear 3 is blocked, and gear 4 uses double normal selectivity with 3 parameters.

I know this is not a simple as the previous way of doing things, but it gets all of the options in there (except the nodes got the boot). What do we think????

wStockhausen commented 9 years ago

Darcy,

In the new Tanner model, I've got 6 selectivity parameters (pS1-pS6) and 6 associated devs vectors (pDevsS1-pDevsS6) that could be potentially applied to a given selectivity function. The parameters and devs applied to each selectivity function (28 functions defined in example below) are identified by index and assigned to each function in the block starting with "PARAMETER_COMBINATIONS" below. Individual parameters and devs vectors can be applied to multiple selectivity functions. The individual parameters (pS1, pS2, etc) and devs (pDevsS1, etc) are the assigned below that (in the block starting with "PARAMETERS". Here's an excerpt from the "parameters configuration file":

-------------------------------

Selectivity parameters

-------------------------------

selectivities #process name PARAMETER_COMBINATIONS 28 #number of rows defining combinations

id YEAR_BLOCK pS1 pS2 pS3 pS4 pS5 pS6 pDevsS1 pDevsS2 pDevsS3

pDevsS4 pDevsS5 pDevsS6 fsZ SelType

survey

1 [1975:1981] 1 1 0 0 0 0 0 0 0 0 0 0 0 asclogistic5095 #z50, dz95 for AFSC.1975-1981 males 2 [1975:1981] 2 2 0 0 0 0 0 0 0 0 0 0 0 asclogistic5095 #z50, dz95 for AFSC.1975-1981 females 3 [1982:-2] 3 3 0 0 0 0 0 0 0 0 0 0 0 asclogistic5095 #z50, dz95 for AFSC.1982+ males 4 [1982:-2] 4 4 0 0 0 0 0 0 0 0 0 0 0 asclogistic5095 #z50, dz95 for AFSC.1982+ females

TCF

5 [-1:-1] 5 5 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for TCF females (entire model period) 6 [-1:1990] 6 6 0 0 0 0 0 0 0 0 0 0 -1 asclogisticLn50 #ln(z50), slope for TCF males pre-1991 7 [1991:1996] 6 6 0 0 0 0 1 0 0 0 0 0 -1 asclogisticLn50 #ln(z50), slope for TCF males 1991-1996 (slope same as pre-1991) 8 [2005:2009] 6 7 0 0 0 0 1 0 0 0 0 0 -1 asclogisticLn50 #ln(z50), slope for TCF males 2005-2009 9 [-1] 6 7 0 0 0 0 1 0 0 0 0 0 -1 asclogisticLn50 #ln(z50), slope for TCF males 2013

TCF retained

10 [-1:1990] 10 10 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for TCF retained males (pre-1991) 11 [1991:-1] 11 11 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for TCF retained males (1991+)

SCF

12 [-1:1996] 12 12 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for SCF females (pre-1997) 13 [1997:2004] 13 13 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for SCF females (1997-2004) 14 [2005:-1] 14 14 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for SCF females (2005+) 15 [-1:1996] 15 15 1 1 0 0 0 0 0 0 0 0 0 dbllogistic #asc(z50, slope), dsc(z50, slope) for SCF males (pre-1997) 16 [1997:2004] 16 16 2 2 0 0 0 0 0 0 0 0 0 dbllogistic #asc(z50, slope), dsc(z50, slope) for SCF males (1997-2004) 17 [2005:-1] 17 17 3 3 0 0 0 0 0 0 0 0 0 dbllogistic #asc(z50, slope), dsc(z50, slope) for SCF males (2005+)

RKF

18 [-1:1996] 18 18 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF females (pre-1997) 19 [1997:2004] 19 19 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF females (1997-2004) 20 [2005:-1] 20 20 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF females (2005+) 21 [-1:1996] 21 21 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF males (pre-1997) 22 [1997:2004] 22 22 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF males (1997-2004) 23 [2005:-1] 23 23 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for RKF males (2005+)

GTF

24 [-1:1986] 24 24 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF females (pre-1997) 25 [1987:1996] 25 25 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF females (1997-2004) 26 [1997:-1] 26 26 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF females (2005+) 27 [-1:1986] 27 27 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF males (pre-1997) 28 [1987:1996] 28 28 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF males (1997-2004) 29 [1997:-1] 29 29 0 0 0 0 0 0 0 0 0 0 0 asclogistic #z50, slope for GTF males (2005+) PARAMETERS pS1 #1st input to selectivity function 26 #number of parameters

id lower upper jitter? init_val phase resample? prior_wgt

prior_type prior_params prior_consts

survey

1 0 200 OFF 50.0 2 OFF 1 normal 75 100 #z50 for sel(1): AFSC.1975-1981 males 2 0 200 OFF 50.0 2 OFF 1 normal 75 100 #z50 for sel(2): AFSC.1975-1981 females 3 0 200 OFF 50.0 2 OFF 1 normal 75 100 #z50 for sel(3): AFSC.1982+ males 4 0 200 OFF 50.0 2 OFF 1 normal 75 100 #z50 for sel(4): AFSC.1982+ females

TCF

5 80 150 OFF 115.0 3 OFF 1 normal 100 100 #z50 for sel(5): TCF female selectivity (all years) 6 4 5 OFF 4.5 3 OFF 1 normal 4.5 2 #mean ln(z50) for sel(6,7,8,9): TCF males (all years)

Dummies (not estimated)

7 -1 -1 OFF 0 -1 OFF 1 none #dummy 8 -1 -1 OFF 0 -1 OFF 1 none #dummy 9 -1 -1 OFF 0 -1 OFF 1 none #dummy

TCF retention

10 85 160 OFF 122.5 3 OFF 1 normal 100 100 #z50 for sel(10): retained TCF males pre-1991 11 85 160 OFF 122.5 3 OFF 1 normal 100 100 #z50 for sel(11): retained TCF males 1991+

SCF

12 50 150 OFF 100.0 -4 OFF 1 normal 100 100 #z50 for sel(12): SCF females pre-1997 13 50 120 OFF 85.0 -4 OFF 1 normal 100 100 #z50 for sel(13): SCF females 1997-2004 14 50 120 OFF 85.0 -4 OFF 1 normal 100 100 #z50 for sel(14): SCF females 2005+ 15 60 150 OFF 100.0 -4 OFF 1 normal 100 100 #asc z50 for sel(15): SCF males pre-1997 16 60 150 OFF 100.0 -4 OFF 1 normal 100 100 #asc z50 for sel(16): SCF males 1997-2004 17 60 150 OFF 100.0 -4 OFF 1 normal 100 100 #asc z50 for sel(17): SCF males 2005+

RKF

18 50 150 OFF 100.0 -3 OFF 1 normal 100 100 #z50 for sel(18): RKF females pre-1997 19 50 150 OFF 100.0 -3 OFF 1 normal 100 100 #z50 for sel(19): RKF females 1997-2004 20 50 170 OFF 110.0 -3 OFF 1 normal 100 100 #z50 for sel(20): RKF females 2005+ 21 95 150 OFF 122.5 -3 OFF 1 normal 100 100 #z50 for sel(21): RKF males pre-1997 22 95 150 OFF 122.5 -3 OFF 1 normal 100 100 #z50 for sel(22): RKF males 1997-2004 23 95 150 OFF 122.5 -3 OFF 1 normal 100 100 #z50 for sel(23): RKF males 2005+

GTF

24 40 125.01 OFF 82.505 3 OFF 1 normal 100 100 #z50 for sel(24): GTF females pre-1987 25 40 250.01 OFF 145.005 3 OFF 1 normal 100 100 #z50 for sel(25): GTF females 1987-1996 26 40 150.01 OFF 95.0 3 OFF 1 normal 100 100 #z50 for sel(26): GTF females 1997+ 27 40 120.01 OFF 80.005 3 OFF 1 normal 100 100 #z50 for sel(27): GTF males pre-1987 28 40 120.01 OFF 80.005 3 OFF 1 normal 100 100 #z50 for sel(28): GTF males 1987-1996 29 40 120.01 OFF 80.005 3 OFF 1 normal 100 100 #z50 for sel(29): GTF males 1997+ pS2 #2nd input to selectivity function 27 #number of parameters

id lower upper jitter? init_val phase resample? prior_wgt

prior_type prior_params prior_consts

survey dz95's

1 0 100 OFF 50 2 OFF 1 normal 50 100 #dz95 for sel(1) AFSC.1975-1981 males 2 0 100 OFF 50 2 OFF 1 normal 50 100 #dz95 for sel(2) AFSC.1975-1981 females 3 0 100 OFF 50 2 OFF 1 normal 50 100 #dz95 for sel(3) AFSC.1982+ males 4 0 100 OFF 50 2 OFF 1 normal 50 100 #dz95 for sel(4) AFSC.1982+ females

TCF slopes

5 0.1 0.4 OFF 0.25 3 OFF 1 normal 0.25 2 #slope for sel(5) TCF female selectivity 6 0.05 0.75 OFF 0.40 3 OFF 1 normal 0.25 2 #slope for sels(6,7) TCF male selectivity pre-1997 7 0.1 0.4 OFF 0.25 3 OFF 1 normal 0.25 2 #slope for sels(8,9) TCF male selectivity 2005+

Dummies (not estimated)

8 -1 -1 OFF 0 -1 OFF 1 none #dummy 9 -1 -1 OFF 0 -1 OFF 1 none #dummy

TCF retention

10 0.25 1.01 OFF 0.63 3 OFF 1 normal 0.75 2 #slope for sel(10) retained TCF males pre-1991 11 0.25 2.01 OFF 1.13 3 OFF 1 normal 1.1 2 #slope for sel(11) retained TCF males 1991+

SCF asc slopes

12 0.05 0.5 OFF 0.275 -4 OFF 1 normal 0.25 2 #slope for sel(12) SCF females pre-1997 13 0.05 0.5 OFF 0.275 -4 OFF 1 normal 0.25 2 #slope for sel(13) SCF females 1997-2004 14 0.05 0.5 OFF 0.275 -4 OFF 1 normal 0.25 2 #slope for sel(14) SCF females 2004+ 15 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #asc slope for sel(15) SCF males pre-1997 16 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #asc slope for sel(16) SCF males 1997-2004 17 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #asc slope for sel(17) SCF males 2004+

RKF slopes

18 0.005 0.5 OFF 0.2525 -3 OFF 1 normal 0.25 2 #slope for sel(18) RKF females pre-1997 19 0.005 0.5 OFF 0.255 -3 OFF 1 normal 0.25 2 #slope for sel(19) RKF females 1997-2004 20 0.01 0.5 OFF 0.255 -3 OFF 1 normal 0.25 2 #slope for sel(20) RKF females 2004+ 21 0.01 0.5 OFF 0.255 -3 OFF 1 normal 0.25 2 #slope for sel(21) RKF males pre-1997 22 0.01 0.5 OFF 0.255 -3 OFF 1 normal 0.25 2 #slope for sel(22) RKF males 1997-2004 23 0.01 0.5 OFF 0.255 -3 OFF 1 normal 0.25 2 #slope for sel(23) RKF males 2004+

GTF slopes

24 0.01 0.5 OFF 0.255 3 OFF 1 normal 0.25 2 #slope for sel(24) GTF females pre-1987 25 0.005 0.5 OFF 0.2525 3 OFF 1 normal 0.25 2 #slope for sel(25) GTF females 1987-1996 26 0.01 0.5 OFF 0.255 3 OFF 1 normal 0.25 2 #slope for sel(26) GTF females 1997+ 27 0.01 0.5 OFF 0.255 3 OFF 1 normal 0.25 2 #slope for sel(27) GTF males pre-1987 28 0.01 0.5 OFF 0.255 3 OFF 1 normal 0.25 2 #slope for sel(28) GTF males 1987-1996 29 0.01 0.5 OFF 0.255 3 OFF 1 normal 0.25 2 #slope for sel(29) GTF males 1997+ pS3 #3rd input to selectivity function 3 #number of parameters

id lower upper jitter? init_val phase resample? prior_wgt

prior_type prior_params prior_consts

SCF males descending limb z50s

1 40 200 OFF 120.0 -4 OFF 1 normal 120 100 #dsc z50 for sel(15): SCF males pre-1997 sel(9) 2 40 200 OFF 120.0 -4 OFF 1 normal 120 100 #dsc z50 for sel(16): SCF males 1997-2004 3 40 200 OFF 120.0 -4 OFF 1 normal 120 100 #dsc z50 for sel(17): SCF males 2005+ pS4 #4th input to selectivity function 3 #number of parameters

id lower upper jitter? init_val phase resample? prior_wgt

prior_type prior_params prior_consts

SCF males descending limb slopes

1 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #dsc slope for sel(15) SCF males pre-1997 2 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #dsc slope for sel(16) SCF males 1997-2004 3 0.01 0.5 OFF 0.255 -4 OFF 1 normal 0.25 2 #dsc slope for sel(17) SCF males 2004+ pS5 #5th input to selectivity function 0 #number of parameters pS6 #6th input to selectivity function 0 #number of parameters pDevsS1 #annual deviations associated with pS1 1 #number of parameter vectors

id idx.type block read? lower upper jitter?

init_val phase resample? prior_wgt prior_type prior_params prior_consts 1 YEAR [1991:1996;2005:2009;2013] FALSE -0.5 0.5 OFF 0 3 OFF 1 normal 0 2

ln(z50) devs for TCF male selectivity post-1991

pDevsS2 #annual deviations associated with pS2 0 #number of parameter vectors

id idx.type min.idx max.idx read? lower upper jitter? init_val

phase resample? prior_wgt prior_type prior_params prior_consts pDevsS3 #annual deviations associated with pS3 0 #number of parameter vectors

id idx.type min.idx max.idx read? lower upper jitter? init_val

phase resample? prior_wgt prior_type prior_params prior_consts pDevsS4 #annual deviations associated with pS4 0 #number of parameter vectors

id idx.type min.idx max.idx read? lower upper jitter? init_val

phase resample? prior_wgt prior_type prior_params prior_consts pDevsS5 #annual deviations associated with pS5 0 #number of parameter vectors

id idx.type min.idx max.idx read? lower upper jitter? init_val

phase resample? prior_wgt prior_type prior_params prior_consts pDevsS6 #annual deviations associated with pS6 0 #number of parameter vectors

id idx.type min.idx max.idx read? lower upper jitter? init_val

phase resample? prior_wgt prior_type prior_params prior_consts

One thing to note above (other than that the Tanner model is a bit nuts) is that the year block across which the S1 devs (pDevsS1) are defined is non-contiguous because these apply to the directed fishery, which was closed 1997-2004 and 2010-2012.

Cheers,

Buck


On Mon, Jul 20, 2015 at 8:29 PM, Darcy Webber notifications@github.com wrote:

OK, I need to come up with a way to deal with selectivity in the control file. This approach needs to include the following additional features:

  • Priors
  • Sex-specificity
  • Additional parameters if say the double normal selectivity function is required (3 params)

I've taken a look at iSCAM, the NZ rock lobster model and what we have in place currently and had a think about how this could look, this is my first go at it so I am happy to take any suggestions at all over the next couple of days. What e used to have was this:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

sel sel sel sex size year phz start end

Index type mu sd dep nodes nodes mirror lam1 lam2 lam3 | block block

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Selectivity P(capture of all sizes)

1 3 100 120 0 1 1 -1 12.5 12.5 12.5 1975 2014 2 3 110 150 0 1 1 4 12.5 12.5 12.5 1975 2014 3 3 60 65 0 1 1 -3 12.5 12.5 12.5 1975 1981 3 3 60 65 0 1 1 -3 12.5 12.5 12.5 1982 2014 4 3 70 90 0 1 1 -4 12.5 12.5 12.5 1975 2014

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

and what I am proposing is this

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

gear par sel sel prior prior prior phz start end

index index type par sex init type mu sd mirror block block

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Selectivity P(capture of all sizes)

1 1 3 1 1 100 0 10 200 3 1975 2014 1 2 3 2 1 120 0 10 200 3 1975 2014 1 3 3 1 2 100 0 10 200 4 1975 2014 1 4 3 2 2 120 0 10 200 4 1975 2014 2 5 3 1 1 110 0 10 200 3 1975 2014 2 6 3 2 1 150 0 10 200 3 1975 2014 2 7 3 1 2 110 0 10 200 -5 1975 2014 2 8 3 2 2 150 0 10 200 -6 1975 2014 3 9 3 1 1 60 0 5 100 3 1975 1981 3 10 3 2 1 65 0 5 100 3 1975 1981 3 11 3 1 1 60 0 5 100 3 1982 2014 3 12 3 2 1 65 0 5 100 3 1982 2014 3 13 3 1 2 60 0 5 100 -9 1975 1981 3 14 3 2 2 65 0 5 100 -10 1975 1981 3 15 3 1 2 60 0 5 100 -11 1982 2014 3 16 3 2 2 65 0 5 100 -12 1982 2014 4 17 4 1 1 10 0 1 50 3 1975 2014 4 18 4 2 1 50 0 10 100 3 1975 2014 4 19 4 3 1 75 0 10 200 3 1975 2014 4 20 4 1 2 10 0 1 50 -17 1975 2014 4 21 4 2 2 50 0 10 100 -18 1975 2014 4 22 4 3 2 75 0 10 200 -19 1975 2014

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

So this proposed way forward specifies a parameter per line, and a sex on a different line. I have retained the mirror concept that Steve came up with as I think it is very useful. I'll walk through this - from the left to the right column we have the gear index, a par index (every parameter gets a different index), a sel type (all the usual suspects, but I will add double normal as option 4), sel par (each of the parameters of the selectivity function selected, e.g. logistic95 has two parameters), sex, prior type, prior mu (or just the first par if say a uniform is used), prior sd, phz mirror (this either species a phase for estimation, or mirrors any of the unique par index), start block and end block.

So above the first gear type is sex-specific (e.g. no phz mirror is used) and is logistic95; the second gear type is not sex-specific (e.g. the phz mirror is pointing at the pars -5 and -6 for the females, which are the male pars), gear 3 is blocked, and gear 4 uses double normal selectivity with 3 parameters.

I know this is not a simple as the previous way of doing things, but it gets all of the options in there (except the nodes got the boot). What do we think????

Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/144.

jimianelli commented 9 years ago

My thoughts are leaning towards Darcy's approach outlined above with the possible added modifications: 1) some header (by gear) specifying the type of selectivity and the extent that it's sex specific 2) given 1), error traps if the number of lines are different than expected or if timeframe has gaps 3) possible sex specific "doubling-up" when sex==2 similar to what's been done earlier for growth in gmacs 4) Advantages include highly flexible, rigorous specification of priors and types and years vary; wonder if 2-d spline used (time and age) that "block" years would become problematic? or perhaps they would specify the knot location for the time-spline part...

[petty aside--prefer "period" over "block" for terminology]

quantifish commented 9 years ago

Thank you both for your comments.

I've gone ahead and made a start on this. Jim, your point 1), I have made a header by gear and sex that specifies the selectivity type, I've not bothered with any sex-specification here and have instead opted to use your point 3) and double up sex-specific selectivities. This does lead to redundancy as often many lines for females will just mirror that of the males, but I think doing it this way make it very clear.

I agree with all the error traps and these will be put in place and happy to change from block to period. I've not thought the spline thing through in its entirety yet, but I also think doing it this way will allow for us to specify whatever we like... For example, if we say that we want a spline, the user could specify whatever option number that will be, then the code will expect say the first line to specify the years and the second the ages or something like that...

Buck: wow Tanner crabs are nuts! Not to worry, I think that this specification will be flexible enough for whatever people can throw at it. I am shying away from a fixed number of parameters due to the spline thing (e.g. someone may want to specify a spline with many knots or something like that).

smartell commented 9 years ago

Sorry for the slow response. My junk mail folder is challenged by github. My only comment is that penalty weights (undocumented of course) lam1... lam3 are probably necessary for selectivities based on coefficients. If that is even still an option.

quantifish commented 9 years ago

OK so I am almost done the changes here to get selectivity up and going as we would like it. So yes, coefficients will definitely be an option (not coded up yet but it will be), these can be implemented by specifying lam1,...,lam3 on different lines in the same way the different parameters of the logistic or double normal parameters are all specified on their own lines now.

Now I am looking at issue #91 which is selectivity bounds and priors. Now that we have different lines I can set up the bounds/priors for each parameter individually. However, we have a choice here: currently the selectivity parameters (and some of the key parameters) are in log-space, we could leave this as is and either

Same applies for issue #67.

wStockhausen commented 9 years ago

In regards to parameters/priors, I think if the parameters are "naturally" positive, then you want to estimate them on the ln-scale, which of course guarantees that the arithmetic scale values will be positive. I think, however, that the priors are more intuitively specified on the arithmetic scale. Most of the priors aren't true priors in the Bayesian sense anyway, but instead reflect "expert opinion" (the assessment author's) as to what range of parameter values is reasonable to consider--and more than likely that opinion will be informed from an arithmetic scale.

BTW, I seem to have run into trouble in the past when I've tried to use a prior (e.g., gamma or lognormal) on an arithmetic scale parameter that was positive definite to keep the estimate from going to zero. Theoretically, it shouldn't happen, but I've had times where the parameter estimate went very small and negative before the model blew up. I think this had to do with the finite nature of math on a computer, but ended up just trying to avoid that sort of situation.

Buck

jimianelli commented 9 years ago

I too instinctively prefer ln-scale for estimation and applying priors on the arithmetic (Darcy's third bullet I guess). Another potential benefit would be with mapping initial values (log to arithmetic) to help with the user's interpretation. Retaining capabilities to do rigorous integration and proper priors would also be a priority as well.

quantifish commented 9 years ago

OK cool, will go with the third option: parameters that are positive to be in log-space where appropriate, priors in natural space with the appropriate derivative applied to the pdf. I notice that a lot of people bugger this up and apply priors to log-transformed variables without considering what that means, or do not apply the derivative/adjustment if they do apply priors in natural space. I'll aim to make this very clear in the documentation.

@wStockhausen yeah I've had similar issues before, particularly with standard deviation parameters that crash to zero despite using lognormal proposal distributions and I figured out that was due to computer arithmetic. I just solved it by imposing additional bounds at (1e-100, Inf), which is easily done in ADMB.