Forums

Back

SS_doRetro

LK
Laurie Kell, modified 3 Years ago.

SS_doRetro

Youngling Posts: 5 Join Date: 1/13/18 Recent Posts

I have problems with the retrospective analysis, as set up using SS_doRetro

I am using SS 3.3.24 under linux and want to do a retrospective analysis. The "0" scenario runs as normal.

I ran SS_doRetro and I get this error

Error trying to open data input file ss3_3.24z.dat
 reading from STARTER.SS
 reading from data file
Data read sucessful 999

 reading forecast file
 reading from control  file
Error: Invalid index -6 used for array range [0, 34] in "int& ivector::operator() (int i)".
array bound exceeded -- index too low

 

The retrospective files created by SS_doRetro are attached, and the master files is in the zip file.

Laurie

LK
Laurie Kell, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 5 Join Date: 1/13/18 Recent Posts

It also fails with the windows exe, but gives a different error message "Illegal male selex option selected for fleet 2"

KJ
Kelli Faye Johnson, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 28 Join Date: 6/13/17 Recent Posts

Sorry about this Laurie. We were able to recreate the problem locally on a windows machine, but can you let us know which 3.24 exe you are using? Typically, there is a letter after it, like 3.24Z.

LK
Laurie Kell, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 5 Join Date: 1/13/18 Recent Posts
It is 3_3.24z Laurie ⁣Sent from Blue ​ On Dec 9, 2020, 5:09 PM, at 5:09 PM, Kelli Faye Johnson wrote: >Sorry about this Laurie. We were able to recreate the problem locally >on a windows machine, but can you let us know which 3.24 exe you are >using? Typically, there is a letter after it, like 3.24Z. > > >-- >Kelli Faye Johnson Stock Synthesis Virtual Lab Forum >https://vlab.noaa.gov/web/stock-synthesis/public-forums/-/message_boards/view_message/12845342 >VLab.Notifications@noaa.gov
Richard Methot, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 219 Join Date: 11/24/14 Recent Posts

Hi Laurie,

I'm not sure that we will be able to solve this problem as all of our development and investigation energy has been with SS3.30 for some time now.  I looked at the input files and noticed that there are time-varying Qdevs and also selectivity devs.  SS3.24 was not very advanced with regard to dealing with time-varying parameters that were designed for the base model but then overlapped into the forecast period when doing the retro.  So my recommendation is to modify the year range for the time-vary parameters such that they do not overlap into forecast when doing the retro.  I'm not certain this will fix the problem, but it is my best suggestion at this time.

Rick

 

LK
Laurie Kell, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 5 Join Date: 1/13/18 Recent Posts
Many thanks for this. I did manage to run a retrospective  analysis by peeling back the CPUE and length compositions. A question then is do these give the same result as do_ssRetro? Laurie ⁣Sent from Blue ​ On Dec 9, 2020, 5:29 PM, at 5:29 PM, Richard Methot wrote: >Hi Laurie, > >I'm not sure that we will be able to solve this problem as all of our >development and investigation energy has been with SS3.30 for some time >now. I looked at the input files and noticed that there are >time-varying Qdevs and also selectivity devs. SS3.24 was not very >advanced with regard to dealing with time-varying parameters that were >designed for the base model but then overlapped into the forecast >period when doing the retro. So my recommendation is to modify the >year range for the time-vary parameters such that they do not overlap >into forecast when doing the retro. I'm not certain this will fix the >problem, but it is my best suggestion at this time. > >Rick > > > > >-- >Richard Methot Stock Synthesis Virtual Lab Forum >https://vlab.noaa.gov/web/stock-synthesis/public-forums/-/message_boards/view_message/12845850 >VLab.Notifications@noaa.gov
IT
Ian Taylor, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 117 Join Date: 12/8/14 Recent Posts

Glad you got it working, Laurie. The SS_doRetro() function in r4ss just modified the starter file and re-runs SS, so just saves time but doesn't differ from going through those steps manually. All CPUE and comp data from after the chosen retro year are ignored in those analyses, so removing them manually should have the identical effect. To confirm this, you could use a model for which the standard retro process works without error.

I should note that one subtlety about retrospective analyses in SS is the use of the bias adjustment, where the inputs provided for when the recruitment bias adjustment ramps down aren't automatically shifted as you remove data (and thus information about the most recent recruitments).  The line between the main and late/forecast recdevs is also unchanged. Thus, the retro model you get may not match the settings you would have chosen if you were setting up that model manually. Adding automatic adjustment is on the wishlist but hasn't been prioritized so far.

LK
Laurie Kell, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 5 Join Date: 1/13/18 Recent Posts
Thanks, I tried out my code on another stock and got the same results as r4ss version, so it looks like the problem is fixed. Thanks for the help. Laurie ⁣Sent from Blue ​ On Dec 9, 2020, 6:05 PM, at 6:05 PM, Ian Taylor wrote: >Glad you got it working, Laurie. The SS_doRetro() function in r4ss just >modified the starter file and re-runs SS, so just saves time but >doesn't differ from going through those steps manually. All CPUE and >comp data from after the chosen retro year are ignored in those >analyses, so removing them manually should have the identical effect. >To confirm this, you could use a model for which the standard retro >process works without error. > >I should note that one subtlety about retrospective analyses in SS is >the use of the bias adjustment, where the inputs provided for when the >recruitment bias adjustment ramps down aren't automatically shifted as >you remove data (and thus information about the most recent >recruitments). The line between the main and late/forecast recdevs is >also unchanged. Thus, the retro model you get may not match the >settings you would have chosen if you were setting up that model >manually. Adding automatic adjustment is on the wishlist but hasn't >been prioritized so far. > > >-- >Ian Taylor Stock Synthesis Virtual Lab Forum >https://vlab.noaa.gov/web/stock-synthesis/public-forums/-/message_boards/view_message/12846749 >VLab.Notifications@noaa.gov
JD
Jemery Day, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 1 Join Date: 9/6/17 Recent Posts

Hi,

 

Sorry for the slow response – I’m not sure if this is still of interest. We routinely conduct retrospectives with our SS assessments now and typically use the SS_doRetro() function, as a shortcut, and take advantage of all the plotting structures and outputs that are produced.

 

However, we routinely modify the SS input files produced by these functions and re-run them – to modify some of the defaults from SS_doRetro. There are a number of changes that could be made, including modifying the bias adjustments, that Ian refers to below. We typically ignore that nuance. However, as I understand it, SS now automatically truncates the part of the bias adjustment that slopes off on the right hand side, either at the last year of recruitment estimates or the last year of input data, so if the right hand bend in the bias adjustment happens early enough (the entry in the control file with comment #_last_yr_fullbias_adj_in_MPD), this truncation may still result in some adjustment of the bias ramp as years of data are dropped out (perhaps?). I’m sure Ian Taylor or others can correct any of these details that I may have misinterpreted.

 

Here is the standard warning indicating this “truncation”

 

bias adjustment ramp extends into forecast; biasadj set to 0.0 internally for forecast years

 

This raises two additional points where there could potentially be further adjustments to each of the retrospective runs. We address the first of these, but ignore the second.

 

(i)                  The last year that recruitments are estimated (the entry in the control file with the comment # last year of main recr_devs; forecast devs start in following year). I don’t think SS_doRetro adjusts this value in the control file. We go in and adjust this manually, decreasing the value by 1 for each year of data that is left out of the model run. If you don’t do this and remove 5 years of data, the last recruitments being estimated can give weird recruitment spikes, as they are no longer being constrained by any information on recruitment from the length and age data. We don’t think this is behaviour that you want to be examining in a retrospective analysis – so we adjust these last year of recruitment estimates values manually, re-run SS in each sub-directory and then use the SS plotting (re-running this) that has been nicely set up by SS_doRetro

(ii)                Iterative reweighting. As age and length data are removed from the  runs, in theory the standard iterative reweighting done to tune the input and output variances should be repeated. Typically, we don’t repeat this procedure for any of the standard sensitivities that we do, such as varying h or M (this would take too long) nor do we do this for our retrospective analyses. It could be argued that this should be done, both for sensitivities and for retrospectives. This is not something that could be easily automated in SS_doRetro, partly because there are different versions of iterative reweighting used in different assessments. This does beg the question of whether others will routinely iteratively re-weight any standard sensitivities that are run for assessments? The extra time required to do this used to make it prohibitive (especially with manual iterative-weighting), but with automation of iterative re-weighting, it seems this is something that could be done. My question is should it be done?

 

ciao

Jemery

From: Ian Taylor <VLab.Notifications@noaa.gov>
Sent: Thursday, 10 December 2020 5:05 AM
To: VLab.Notifications@noaa.gov
Subject: [Stock Synthesis - r4ss] SS_doRetro

 

Glad you got it working, Laurie. The SS_doRetro() function in r4ss just modified the starter file and re-runs SS, so just saves time but doesn't differ from going through those steps manually. All CPUE and comp data from after the chosen retro year are ignored in those analyses, so removing them manually should have the identical effect. To confirm this, you could use a model for which the standard retro process works without error.

I should note that one subtlety about retrospective analyses in SS is the use of the bias adjustment, where the inputs provided for when the recruitment bias adjustment ramps down aren't automatically shifted as you remove data (and thus information about the most recent recruitments).  The line between the main and late/forecast recdevs is also unchanged. Thus, the retro model you get may not match the settings you would have chosen if you were setting up that model manually. Adding automatic adjustment is on the wishlist but hasn't been prioritized so far.


--
Ian Taylor Stock Synthesis Virtual Lab Forum https://vlab.noaa.gov/web/stock-synthesis/public-forums/-/message_boards/view_message/12846749 VLab.Notifications@noaa.gov

Richard Methot, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 219 Join Date: 11/24/14 Recent Posts

Jemery,

Thanks for the additional information and clarifications.  I agree that doing iterative reweighting would be too difficult to integrate into his procedure, so it would be better to use the extra_sd parameter for indexes and the Dirichlet-Multinomial for composition data.  Whether or not you should allow these to change while doing a retro is an interesting question that warrants some deeper thought.

  Most team members are taking some time off for the holidays, so we are unlikely to do anything on this until January.  Please get back in touch then if you don't hear from us.

Rick

IT
Ian Taylor, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 117 Join Date: 12/8/14 Recent Posts

Thanks for chiming in, Jemery. It's good to hear what the current approach is in your part of the world.

Here are a bit more on this subject:

[UPDATE: just saw that some of this email is redundant with what Kathryn just wrote, but sending anyway.]

You are correct about the bias adjustment being set automatically to 0 in the forecast years, but from what I can tell, the years with data removed by the retrospective settings are not considered forecast years. That is, in the SPAWN_RECRUIT table in Report.sso ($recruit is r4ss) the "era" column remains as "Main" or "Late" and the "biasadjuster" is unchanged and non-zero for those years. However, automatically setting the bias adjustment to 0 for those years would be an easy, if incomplete, solution to the problem of bias adjusted recdevs that have zero information in the data. Automatically adjusting the ramp parameters would probably be a better solution, but we should do some research to show if this makes sense in general.

On data-weighting, I agree with Rick's suggestion that the automated tuning options are the idea, but we should make sure to keep track of the resulting parameter estimates to see how they change when the recent data is removed. Kathryn updated the SS_tune_comps() function in r4ss to automate the iterative re-weighting process for Francis and McAllister-Ianelli data weighting methods (see note here https://github.com/r4ss/r4ss/issues/450) and in theory that could be combined with the SS_doRetro() function to automatically tune the retro models. But again the results might not always be sensible and the interpretation of any retrospective pattern might be different if the data weights are changing substantially.

 

KD
Kathryn Doering, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 57 Join Date: 2/19/19 Recent Posts

Hi Jemery,

 

These are good points, thank you for bringing them up!

 

I just wanted to bring up that there is now functionality to automatically reweight using Macallister-Ianelli or Francis weighting in the SS_tune_comps function in r4ss: https://github.com/r4ss/r4ss/blob/development/R/SS_tune_comps.R .

It should be possible to add a routine to r4ss that does retrospectives with iterative reweighting, if there is enough interest. I would be happy to help out with this, although like Rick mentioned, not on a very short timeline!

Perhaps this should be opened and discussed as an issue in the r4ss repository? Please feel free to open one.

 

Thanks,

Kathryn

KD
Kathryn Doering, modified 3 Years ago.

RE: SS_doRetro

Youngling Posts: 57 Join Date: 2/19/19 Recent Posts

I should have also said, this would not address all the complexities of your input, of course!