timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

Question: should ragged IAA_mats (varying ages) work by using index_sel_start_age and index_sel_end_age? #37

Open tcarruth opened 3 years ago

tcarruth commented 3 years ago

Line 173 of prepare_wham_input():

temp = asap3$IAA_mats[[i]][, 3 + 1:data$n_ages]

requires that all IAA mats have data for all n_ages. However, the NMFS fall survey (that I have at least) goes from ages 1 to 5, while the spring survey goes from ages 1 to 8.

I was wondering if this is the intended role of the $index_sel_start_age and $index_sel_end_age slots?

It looks like I can just expand out these matrices to include NAs otherwise.

timjmiller commented 3 years ago

Can you send the dat file? I remember this being an issue applying it to some other stock before wham was a package, but I don't remember if/how I fixed wham to account for this ASAP possibility.

On Wed, Mar 10, 2021 at 9:42 PM tcarruth @.***> wrote:

Line 173 of prepare_wham_input():

temp = asap3$IAA_mats[[i]][, 3 + 1:data$n_ages]

requires that all IAA mats have data for all n_ages. However, the NMFS fall survey (that I have at least) goes from ages 1 to 5, while the spring survey goes from ages 1 to 8.

I was wondering if this is the intended role of the $index_sel_start_age and $index_sel_end_age slots?

It looks like I can just expand out these matrices to include NAs otherwise.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/37, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIGN7GX2QFRCJ4WRDSRZETTDANWJANCNFSM4Y7LK43A .

-- Timothy J. Miller, PhD Research Fishery Biologist NOAA, Northeast Fisheries Science Center Woods Hole, MA 508-495-2365

brianstock-NOAA commented 3 years ago

index_sel_start_age and index_sel_end_age are in the ASAP .dat file but not used in WHAM (they're in read_asap3_dat() but not in prepare_wham_input() or wham_v0.cpp). I believe it is necessary to expand the IAA mats to age 8 as you note, because prepare_wham_input() fills in index_paa using IAA_mats[[i]][, 3 + 1:data$n_ages].

If using age-specific selectivity, lines 382-416 of prepare_wham_input check for ages with 0 catch (proportions at age < 1e-5). The selectivity parameters for these ages are set to 0 and mapped to NA (not estimated).