Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectivity re="ar1" with model = "age-specific" options to prepare_wham_input function #61

Open
timjmiller opened this issue May 16, 2022 · 11 comments
Labels
bug Something doesn't work

Comments

@timjmiller
Copy link
Owner

selectivity$model = "age-specific" without random effects will estimate or fix each age-specific selectivity parameter (estimated as fixed effects) according to specifications of the asap3 dat file or (over-ridden by) selectivity$initial_pars and selectivity$fix_pars arguments. When selectivity$re = "ar1" is added, all of the age-specific selectivity fixed effects are still estimated along with corresponding age-specific random effects. This fit is unlikely to (or will never?) converge properly because there are two parameters for each category. (The variance of these random effects goes to 0).

The appropriate default should be to estimate a single fixed effect parameter as the mean across ages to which the age-specific ar1 random effects are added. This can be done by setting the appropriate input$map$logit_selpars entries to be the same value for all estimated ages in the selectivity block. Some care may be needed for convergence when most or all of the ages are fixed with selectivity$fix_pars.

I expect this would also be problematic for other selectivity$model options.

@timjmiller timjmiller added the bug Something doesn't work label May 16, 2022
@brianstock
Copy link
Contributor

AR1 across ages is working now, timjmiller/SSRTWG@3741fde. Added a warning if no ages are fixed but allow model fitting so you can 1) fit model, 2) find age with highest estimated selectivity, 3) use set_selectivity() to fix that age at 1, and 4) re-estimate model. Not thoroughly tested yet.

@Rick-Methot-NOAA
Copy link

How do you handle AR in both age and time such that the age with max selectivity changes over time? Do you have any direct comparisons to the approach as implemented in SAM, or in Ianelli's models?

@timjmiller
Copy link
Owner Author

timjmiller commented Jul 13, 2022 via email

@Rick-Methot-NOAA
Copy link

OK. That's what I figured. So a separate AR process is needed to allow the q for that max_sel age to change over time. Still seems illogical to assert 2DAR process, but one age is not allowed to change. I'll touch on this topic in my CAPAM talk on selectivity

@timjmiller
Copy link
Owner Author

timjmiller commented Jul 13, 2022 via email

@Rick-Methot-NOAA
Copy link

OK. That is what SS3 does as well.

@Cole-Monnahan-NOAA
Copy link
Collaborator

Why not let the user input a vector of ages at which to normalize in each year? So like c(6,6,6,7,8) or something which can be determined from a previous run by taking the max across ages by year? Then you can have all age:year effects in the AR process.

@Rick-Methot-NOAA
Copy link

SS3 and Ianelli's AMAK uses that approach.
A consequence can be that the normalized value of selectivity can be >1 for some ages. That is OK, but need to be careful about reporting the resultant F for that year.

@Cole-Monnahan-NOAA
Copy link
Collaborator

Sorry I didn't mean normalize, I meant divide by the max. So you divide by max in each year as standard but have the user input it as data to preserve differentiability.

@timjmiller
Copy link
Owner Author

@Cole-Monnahan-NOAA how would you know a priori which age to use for scaling if there are RE for each age? It seems like the selectivity>1 issue noted by @Rick-Methot-NOAA could still occur.

@Cole-Monnahan-NOAA
Copy link
Collaborator

You'd have to do a two-step process. Fit the model then do y=apply(selAA,1,which.max) and pass y back in and refit the model w/ that data input. Isn't that what WHAM does now but for a single age? The user can specify it?

Does that break the AR1 structure though? Not sure if that's a good idea to do statistically. If there are large changes in selex then dividing by a different age could move things around and makes interpretation of the RE kinda tricky, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something doesn't work
Projects
None yet
Development

No branches or pull requests

4 participants