gadget-framework / gadget3

TMB-based gadget implemtation
GNU General Public License v2.0
8 stars 6 forks source link

action_weightloss: Implement g3a_weightloss #174 #178

Closed lentinj closed 3 weeks ago

lentinj commented 1 month ago

It's not very complicated atm, but @vbartolino It'd be good to know what you make of this before merging. This would be to implement the moulting weight loss, rather than the weight loss from pupping. IIRC this will be a relative weight loss, the absolute weight loss option wouldn't be immediately useful for us. Some thoughts:

vbartolino commented 1 month ago

I agree. The intention is to allow flexibility to implement weight loss of pupping and moulting (or other physiological processes) separately where needed.

In the ringed seal model, the main reason to represent the seasonal change of weight is because that's linked to fertility (schematic in feeding effect on fertility #2), which is why we'll have a weight loss only for the mature females in our model (no effect on mortality at the moment in the Formas project). We implement this using a formula for the argument proportion_f in g3a_spawn like in https://github.com/vbartolino/g3_GoB/blob/45abba5f3d457bde81295f81edacedb253f6b818/ringedseal_g3/gadget3/06.4-setup/setup_model_2sex_sen.R#L248C24-L250C96 weightloss_fis not specified yet, but it is unclear to me if it would apply to all the mature females or only to the proportion resulting from proportion_f. If it applies to all the mature females, that would be probably enough to represent the combined pupping and moulting weight loss of mature females (sorry if I didn't raise the question before). Otherwise we will need of an additional g3a_weightloss function. Of course, this function would be anyway useful in a general framework (ie, if one want to have a weight loss also for males or immature).

We would like to assume that the weight loss related to the energy invested in a pup is fixed and that one of moulting is related to the animal size (seal experts agreed on this).

Should the relative loss be (wgt - min_weight) * loss + min_weight, i.e. we only lose weight on what our reserves are?

it makes sense, in practice we do not allow to go below min_weight, right?

If we start dipping below min_weight, instead of not going lower, should we automatically include some mortality?

it's probably true, but I suppose a user would think of min_weight differently depending if/how natural mortality is added in relation to weight. For instance, if mortality increases progressively and slowly as the weight decreases below min_level level there might be no need to constrain the weight loss as suggested above, do you agree?

lentinj commented 1 month ago

weightloss_fis not specified yet, but it is unclear to me if it would apply to all the mature females or only to the proportion resulting from proportion_f.

The latter currently. But my plan was to work out the mechanics for both here and then work out how to apply the fertility weight loss. I don't really like having the weightloss_f as part of g3a_spawn(), if I can see a way of using g3a_weightloss for only the population that spawned I think that would be better IMO.

it makes sense, in practice we do not allow to go below min_weight, right?

Falling below min_weight (lean weight in our case) doesn't make a lot of intuitive sense. You're loosing energy reserves, not a flipper.

For instance, if mortality increases progressively and slowly as the weight decreases below min_level level there might be no need to constrain the weight loss as suggested above

I guess it's fairly likely that there will be a g3a_naturalmortality considering weight, to allow for starvation. If we assume that there is, then:

But we do need to have some minimum, as we can't let mean weight be zero or negative. So, I think the answers to my questions are:

Sound good?

vbartolino commented 1 month ago

it sounds good

Falling below min_weight (lean weight in our case) doesn't make a lot of intuitive sense. You're loosing energy reserves, not a flipper.

it's true in our case/simplification, but not necessarily in general as energy can be mobilised also from tissues other than fat (i.e., muscles) especially under severe starvation. However, nothing relevant for our implementation

lentinj commented 3 weeks ago

I've reworked this as we talked about above. I've also added weightloss_args to g3a_spawn, that takes a list of arguments for g3a_weightloss, i.e. you can tell it weightloss_args = list( abs_loss = g3_parameterized(...) ).

As well as the spawning weightloss being against the spawning stock, it also has to happen at a different time (naturalmortality happens before spawning in gadget order of actions). Having it as a separate action would have been possible, but there's lots of fiddly bits to keep in sync to do so. This way g3a_spawn worries about it for you.

I've also fixed a bug with g3a_spawn, if using the defaults for mean_f, etc. It would use the parameters from the mature stock, not the stock that's spawning.