MV tweedie and D-M for sizefreq#357
Conversation
|
Output format looks like this: Note that both fleets share the same comp_err method and parameters. |
|
I checked out why the call-build-ss3-warnings job is failing, and it is just this one additional warning: I think this warning can be safely ignored, so we would just increase the number of warnings expected by 1 (from 83 to 84): https://github.com/nmfs-stock-synthesis/workflows/blob/a62a6c65cd146ceebd3cac4b612cf3d86c0d58d9/.github/workflows/build-ss3-warnings.yml#L64 |
|
The one run that failed the test was because there is one fewer warning with new code and that warning was related to a poor search convergence. So new code is fine. |
|
I'll get to work on reviewing this today. |
|
still need to add a base offset for use of D-M with sizefreq method; then do a comparison test between length-based DM and sizefreq-based DM. Also, last push still had some incorrect effN calcs for method 2 D-M |
|
@Rick-Methot-NOAA, I'm finally done with other meetings. Should I hold off on review until you've corrected Method 2 effN and added offset or just review what's currently in place? |
|
The attached example replicates all length comp data as sizefreq data, assigned both to use the same D-M parameter. Result is the same logL for both length comp and sizefreq comp. |
There was a problem hiding this comment.
@Rick-Methot-NOAA, I looked over all the changes and as far as I can tell things look good although I haven't tried to check the math or compared directly to the equations.
Clearly adding a new likelihood isn't the hard part of this, it's all the variable management and the changes to input/output.
The next steps that I can contribute to would be
- play around with the the D-M_test.zip model that you attached to the Pull Request so I understand things better
- implement the necessary changes in a branch of r4ss that could be used in the testing
- compare parameter estimates for existing models that use DM likelihood like the two hake models in https://github.com/nmfs-stock-synthesis/test-models/tree/main/models. Having the r4ss working again may allow those comparisons to happen automatically via github actions. If models change because of errors in the previous implementation, we should try to document that, but maybe it's just the likelihood values that were wrong, not the MLE estimates.
- update the documentation to describe these changes
- [lower priority than the others] add a model to the test set that uses the Tweedie distribution for age or length and/or DM with generalized size comp
Having said all that, I'm on leave next week, so please proceed as you wish and I'll figure out how to contribute when I get back.
|
@Rick-Methot-NOAA look like the for the run with no est, the two_morph_seas_areas model could not run a second time when using the .ss_new files. maybe the .ss_new file is not being written correctly? The r4ss job is failing because r4ss is not able to read the output correctly. Maybe @kellijohnson-NOAA can help with this? The two added warnings are: These can be safely ignored, I think, as they are coming from admb 13. Also, doesn't this PR require admb 13? We still aren't using admb 13 on all the github actions yet. I think this is something Ian is planning to update when he gets back. |
|
This PR does not need ADMB 13 yet. All references to Tweedie are placeholders. I will look again at the two morph run, but I previously determined that the base run was not fully converged and the new run was slightly better. |
|
compare_logL.xlsx |
|
for sure. glad to have your sharp eyes looking this over. |
- relates to the following: - r4ss/r4ss#735 - nmfs-ost/ss3-source-code#357
|
Changes to r4ss now allow reading the SS3 output associated with this branch (confirmed by the "test-r4ss-with-ss3" workflow with help from @k-doering-NOAA). |
|
Following up on the fixed tests: now only the warnings test is failing (as expected as discussed in #369), so next steps can be to focus on documentation (maybe in combination with nmfs-ost/ss3-doc#123) and any needed changes to the SSI and change log. |
|
I think if you approve and merge, the change log will automatically get updated |
iantaylor-NOAA
left a comment
There was a problem hiding this comment.
@Rick-Methot-NOAA, it seems that the additional commits that occurred after my previous review made the approval no longer apply. The additional changes look good, so this approval should allow you to merge whenever you're ready and take away the "Merging is blocked" message.
- relates to the following: - r4ss/r4ss#735 - nmfs-ost/ss3-source-code#357
|
This code revision introduced errors to *.ssnew for sizecomp data. These are now being corrected with issue #541 |
Concisely (20 words or less) describe the issue
Reorganizes index logic for comp-weighting parameters in anticipation of the 2-parm MV-Tweedie;
adds information to the Fit_Len_Comp, etc. tables in report.sso, so needs r4ss attention
preps for extending D-M and MV-Tweedie to generalized size comp
Please Link issue(s)
still open #266
resolves #365 resolves #185 resolves #66 resolves #360 resolves #362 resolves #219
What tests have been done? Upload any model input files created for testing in a zip file, if possible.
using Andre_tag as testbed. Also all_gen_size_comp modified to have a combo of length, age and sizecomp, and a combo of multinomial and Dirichlet-Multinomial (D-M).
What tests/review still need to be done? Who can do it, and by when is it needed (ideally)?
r4ss needs updating to read the revised Fit_Len, etc. tables
Has any new code been documented?
Yes.
If not, please add documentation before submitting the Pull Request.
is there an input change for users to Stock Synthesis?
If so, please provide an example of the new inputs needed.
Check which is true. This PR requires:
Describe any changes in r4ss/SS3 manual/SSI that are needed (if not checked):
r4ss needs to update processing of the "fit_comp" tables
If changes are needed in the change log, please fill in the table here:
Additional information (optional):
Add functions Comp_logL_multinomial and Comp_logL_Dirichlet to SS_miscfxn.tpl.
These are called by SS_objfun to compute lengthcomp, agecomp and sizefreq logL.
Indexing of CompErr is now by number of invoked methods rather than number of parameters because Tweedie takes 2 parameters
Indexing of CompErr for Sizefreq is by SizeFreq method, not by fleet,
and this indexing is appended to the fleet-based indexing for lencomp and agecomp.
Add code for computing comp logL by Tweedie. This is CompErr == 3. Not operational yet. Need to move into a function like Comp_Err_Dirichlet().
Add Dirichlet capability to sizefreq
In preliminary calcs. correct the offset_l and offset_a calculations which were adding a constant twice (for females and again for males).
In readcontrol, update parameter indexing for D-M in sizefreq; revise the CompErr parameter names;
drop "fleet" from CompErr parameter names because more than 1 fleet can use a parameter.
In write report: major updating to the Fit_Len, Fit_Age, and Fit_Size tables. r4ss needs to check for new column names.
Compreport.sso updated such that the reported logL for each bin now sum to the total logL for that observation as reported in the Fit_Len, etc. tables. This is for multinomial and for D-M.
In write_ssnew: fix a problem with the sample size used for Dirichlet method 2 (Beta).