Open MaC-Perez opened 1 year ago
I don't think you need to get buried in species and years here.
pred_catchsize
is an incomplete vector - it only contains predicted values for length bins that had observations.
You want to simulate from the full expected length compositions, because other realizations from the same vector of probabilities might result in obsrvations in those length bins.
Probably want to use the full predicted size comp tables instead. These are output in pmse_predvals.out
.
We had discussed simplifying so you were fixing the input sample size for the comp data to constant values for all observations, rather than use the sample sizes from the data you used to fit your OM.
Once you have the table with complete predicted length comps, you can iterate through the rows to simulate your new vectors. You don't need the bookkeeping for species/year/fleet within your simulation code, because you know which row corresponds to what based on how the tables were created.
@gavinfay
I have a huge piece of code to organize the composition data in the way I can use the columns into my simulation section of the code (because I have different sample sizes so I can't just read the entire vector). So first I organized my data to be able to get the specific sample size for each bin and year (lines 75-94) (https://github.com/MaC-Perez/Hydra-self-testing/blob/948a34c22575c0d115edead11d9e8160b600f777/hydra_sim.R#L75-L86 but I really want to reduce that part of the code and use a more efficient way … that was I was trying to do in lines 70-73 but my sample size variable doesnt have the same longitude
https://github.com/MaC-Perez/Hydra-self-testing/blob/948a34c22575c0d115edead11d9e8160b600f777/hydra_sim.R#L70-L73