PIFSCstockassessments / 2024-WCNPO-MLS-Rebuilding

1 stars 0 forks source link

Set up bootstrapped numbers at age files for projection analyses #1

Closed JonBrodziak closed 8 months ago

JonBrodziak commented 9 months ago

Question was raised last week about the units of the bootstrapped numbers (BSN) at age file, named, 2023_WCNPOMLS.bsn. The units for the numbers at age were set at 1000s of MLS alive on 1-Jan-2020 for ages 1 to 15 years in successive columns. Each row represented 1 bootstrap replicate.

There are 99 bootstraps in the BSN file.

Could we add the point estimate from the base case run for the numbers at age on 1-Jan-2020 to have a sample size of 100 bootstraps? Or is the point estimate from the base case final run already in the BSN file?

JonBrodziak commented 9 months ago

Michelle indicated today 29-Nov-2023 that she was rerunning the SS3 bootstrap analyses.

michellesculley commented 9 months ago

I've added a new 2023_WCNPOMLS.bsn and a 2023_WCNPOMLS_Quarters.bsn file. These contain the 1-Jan-2021 numbers at age or the start of the quarter (1-Jan, 1-Mar, 1-Jul, 1-Oct 2021) numbers at age for 100 bootstrap runs. They are in units of thousands of fish.

I believe the first bootstrap datafile is the original datafile, but I am not sure.

JonBrodziak commented 9 months ago

The two newly run bootstrap files start in year 2021. This changes the initial year for the MLS projections from 2020 to 2021. This change reduces the uncertainty about the catch and fishing mortality for year 2020, else we would have to make an assumption about catch or F for 2020. đź‘Ť

JonBrodziak commented 9 months ago

2023_WCNPOMLS_Quarters.bsn file needs to be adjusted to include zero numbers at age for non-Q1 quarters.

Bootstrap #1: N1(Q1) 0 0 0 N2(Q2) 0 0 0 N3(Q1) 0 0 0 N4(Q1) ... N15+(Q1) 0 0 0 Bootstrap #2: N1(Q1) 0 0 0 N2(Q2) 0 0 0 N3(Q1) 0 0 0 N4(Q1) ... N15+(Q1) 0 0 0 ... Bootstrap #100: N1(Q1) 0 0 0 N2(Q2) 0 0 0 N3(Q1) 0 0 0 N4(Q1) ... N15+(Q1) 0 0 0

JonBrodziak commented 9 months ago

Adjustment to 2023_WCNPOMLS_Quarters.bsn has been made. Numbers at quarterly ages on Jan-1-2023 for quarterly age not equal to a multiple of 1 are set to zero. The bootstrap data files and a summary have been uploaded to the folder "Bootstrap numbers at age".

michellesculley commented 9 months ago

I guess I'm confused on what this is about. My assumption for doing the quarters as years version of AGEPRO was that we would be applying natural mortality, fishing mortality, growth, etc. on the fish on a quarterly time step with recruitment occuring every 4 years starting in the 3rd year (yr 3, yr 7, yr 11, etc). So you would need the numbers at age by quarter for 2021 to start the model. If my understanding is wrong then that's ok too.

JonBrodziak commented 9 months ago

In the annual projection model the fish are all born in quarter Q3. There are no fish born in quarters 1, 2, & 4. To represent this in a quarterly time step model, we set the number at ages at by quarter to have age-0.0 recruitment occur in quarter 3 in time step 1. In the same time step 1, there are no fish at ages 0.25, 0.5, or 0.75 quarters because there is no recruitment in the previous quarters Q4, Q1, and Q2. In the next time step 2 (or quarter Q4), some of the age-0.0 recruits survive to be age-0.25 and there are no fish of age-0.5 or 0.75 or 1.0, noting the fish that were age-1.0 in Q3 are now the survivors at age 1.25 in quarter Q4. This is the pattern for a quarterly time step model with the birth pulse of recruitment occurring at age-0 in a single quarter Q3.

The bootstrap numbers at age-0, age-1, age-2 and so on are definitely needed to start the quarterly time step projection. The positive numbers at age are spaced out at every 4th array position starting at position 1 with age-0, age-1, age-3, age-4, ..., age-15+ fish numbers at age in array positions 1, 5, 9, 13, ..., 57. The rest of the 60 array positions or elements are zero in time step 1. In time step 2, the surviving numbers at age a+0.25 are located in array positions 2, 6, 10, ..., 58 with zeros in the rest of the array positions. In time step 3, the fish are age+0.5 and the surviving fish are shifted 1 more array position and in time step 4, the fish are age+0.75 and have shifted one more array position. In time step 5, we have new recruitment occurring and the other surviving fish are age+1.0.

This is how I envisioned modeling the quarterly projections for striped marlin with a time step of 0.25 year and the population recruitment all occurring in quarter Q3. On the other hand, if population recruitment in the SS3 model did occur in every quarter then we would need to start the quarterly model off with bootstrap numbers at all quarterly ages in time step 1. This is what I believe the original quarterly bootstrap numbers at age file was set up to do. Let me know if this explanation helps make sense of the updated quarterly bootstrap file, or not.

Thanks, Jon

On Mon, Dec 11, 2023 at 2:34 PM Michelle Sculley @.***> wrote:

I guess I'm confused on what this is about. My assumption for doing the quarters as years version of AGEPRO was that we would be applying natural mortality, fishing mortality, growth, etc. on the fish on a quarterly time step with recruitment occuring every 4 years starting in the 3rd year (yr 3, yr 7, yr 11, etc). So you would need the numbers at age by quarter for 2021 to start the model. If my understanding is wrong then that's ok too.

— Reply to this email directly, view it on GitHub https://github.com/PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/issues/1#issuecomment-1851117103, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVXIZVVZIW44DVJ44TVNDLYI6RCXAVCNFSM6AAAAABAACKA5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJRGEYTOMJQGM . You are receiving this because you modified the open/close state.Message ID: <PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/issues/1/1851117103@ github.com>

-- Jon Brodziak, Ph.D. NOAA Inouye Regional Center Pacific Islands Fisheries Science Center 1845 Wasp Boulevard, Building 176, NMFS/PIFSC/FRMD Mail Room 2247 Honolulu, Hawaii 96818 USA PIFSC Stock Asessment Program https://pifscstockassessments.github.io/ Phone: 808-725-5617 Email: @.***

“Wherever my travels may lead, paradise is where I am.” ~ Voltaire

The views expressed in this message are my own and do not necessarily reflect any position of NOAA.

michellesculley commented 9 months ago

Ah makes sense. I'll update the code. Thanks for the explanation Jon!

JonBrodziak commented 9 months ago

Good to hear. I have set up a Build Input File_test_model_14.R script based on your script. I tested it this week and it correctly pulls the recruitment estimates with a minor change to the filter on pred_recr and the different base case run in base-9-Dec-2023. If it's OK with you, I'd like to move the base-9-Dec-2023 data to the base folder.

I have finished the revisions to the AGEPRO code to provide an option to remove the auxiliary files. This revision has been tested and it works. The new AGEPRO executable is in agepro-dev/bin. I need to update the reference manual but the information on the change is in a comment on this issue here https://github.com/orgs/PIFSCstockassessments/projects/9?pane=issue&itemId=46220486

I ran the test_input.inp input file with the revised AGEPRO yesterday and it produced sensible results using the model 14 with the long-term (44 years) of recruitment & sampling from the ECDF. This is encouraging. There are a couple more issues to address for building the base case annual input file. But it appears the set of Rscripts works and the revised AGEPRO also works. The test run is in: https://github.com/PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/tree/main/Build%20Input%20File/test with output filename: test_input_noreb.out

I will be updating the GitHub issues later today and will add some new steps but overall setting up the base case annual input is going well.

Another minor issue is that I named some folders with spaces between words and would like to change this so that there is a consistent approach for folder names with dashes "-" between the words in the folder name. It's a minor point but let me know if you have any issues with that.

Also curious if you developed any code to get the annual split of fishing mortality by fleet for the 9 unique mirroring fleets?

Thanks! Jon

On Wed, Dec 13, 2023 at 10:07 AM Michelle Sculley @.***> wrote:

Ah makes sense. I'll update the code. Thanks for the explanation Jon!

— Reply to this email directly, view it on GitHub https://github.com/PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/issues/1#issuecomment-1854629785, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVXIZWUTCMVDIBHY3TRK3TYJIDJJAVCNFSM6AAAAABAACKA5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJUGYZDSNZYGU . You are receiving this because you modified the open/close state.Message ID: <PIFSCstockassessments/2024-WCNPO-MLS-Rebuilding/issues/1/1854629785@ github.com>

-- Jon Brodziak, Ph.D. NOAA Inouye Regional Center Pacific Islands Fisheries Science Center 1845 Wasp Boulevard, Building 176, NMFS/PIFSC/FRMD Mail Room 2247 Honolulu, Hawaii 96818 USA PIFSC Stock Asessment Program https://pifscstockassessments.github.io/ Phone: 808-725-5617 Email: @.***

“Wherever my travels may lead, paradise is where I am.” ~ Voltaire

The views expressed in this message are my own and do not necessarily reflect any position of NOAA.

JonBrodziak commented 8 months ago

Checked the new quarterly bootstrap file. The updated ExtractAgeProBSN outputs quarter 3 numbers at age and zeros out quarters 1, 2, and 4. It seems simplest to start the quarterly projections at the same time step as the annual projections. Using quarter 1 as the starting point implies zeroing out the quarter 2, 3, & 4 entries. Doing this will also make the annual and quarterly bootstrap files start with the same numbers at age in quarter 1 for every age class.

JonBrodziak commented 8 months ago

The bootstrap files have been checked and are correct in specifying age-1 to age-15+ numbers at age by row in the terminal year of the MLS assessment (2021).