pdolder / MixFishSim

Code for mixed fishery multi-stock simulation model
GNU General Public License v3.0
3 stars 3 forks source link

Is lambda overwritten in run_sim? #1

Closed Blevy2 closed 2 years ago

Blevy2 commented 2 years ago

Hello @pdolder,

I am using MixFishSim and I understand that the lambda value that is defined within init_pop controls how likely a species is to move long distances. While lambda is defined by a call to init_pop, it appears that fixed values are used in run_sim on lines 89 & 90 where the movement probabilities are calculated. Please let me know what you think.

Thank you,

Ben Levy

pdolder commented 2 years ago

Hi Ben,

First thanks for pointing this out and yes, I agree that here I have hardcoded something that should have been dynamic: https://github.com/pdolder/MixFishSim/blob/1390b9dc5b6a8943d2a9c01f18a4e50737baab45/R/run_sim.R#L89 https://github.com/pdolder/MixFishSim/blob/1390b9dc5b6a8943d2a9c01f18a4e50737baab45/R/run_sim.R#L90

I'll need to dig into the consequences of that and make sure it doesn't affect anything in our study (I don't think it should), but first off I can correct in the code and will push a change. I think in both cases it should be:

lambda = pop_init[["lambda"]][[s]]

Thanks again for the eagle eye on the code!

Paul

Blevy2 commented 2 years ago

Hi Paul,

As a quick follow-up, it doesn't look like lambda is recorded in the init_pop call so that needs to be added first.

best,

Ben

pdolder commented 2 years ago

Thanks again Ben, this should work now - I've tested and seems to be working ok so will close this, but let me know if any issues!

Paul