-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
g3_parameterized()-based defaults #118
Comments
Any understocking should be heavily penalised, make a high weight the default.
There's only one option, so make it the default. Don't bubble up the by_stock / by_age options, as using these is currently a bit hairy at the moment, see: #113 If you want a more parameterized M, it's a bit more sensible to do this yourself, example added to show how to do this.
The final add_dependent_formula call wasn't substituting stock names, run g3_step again so it does. Ideally this would become part of add_dependent_formula. In the process we have another f_optimize() pass over the code, resulting in lots of codegeneration changes.
Generate rec/rec.scalar parameters by default, as used in the ling model: https://github.com/gadget-framework/gadget-models/blob/412dad4ca83b57f0dc4897e5ae576afcdb21b20b/06-ling/gadget3/00-setup/setup-model_components.R#L40-L47
We only renew at the youngest age, so having a quick by_age option doesn't make any sense. It'd be possible to disable "age == stock__minage" in which case it becomes relevant, but then you're not really describing renewal.
The TRUE default is never useful, will at least want: * Only renew at the minimum age * Not a projection year (in which case there's no data) And possibly want: * Step in which to renew at Break up the default clauses into their own parameters, and combine them by default. NB: This is assuming that a stock has an age dimension, which it may not do. Should we be wrapping in if (stock_has_an_age_dimension)?
If any of Linf / K / init.sd / rec.sd are zero, then renewal will result in an NaN stock. These defaults aren't useful either, but at least a model fresh out of the box will return something other than NaN.
It's historical, ripping the band-aid off now will hurt less than it will in the future.
It's historical, ripping the band-aid off now will hurt less than it will in the future.
@willbutler42 any suggestions on what this would look like? We might end up with 2 vonB functions though, which would be a bit annoying from a naming point of view. |
I guess something like:
would take care of my first bullet. The second bullet could be hacked by adding |
Adding But I think we'd need separate |
Sound reasonable. I guess that you can go from |
Okay, so I think the thing to do is:
So models that used We could eventually tidy up the alias if we felt it was worth it once the dust has settled. |
Also (sorry!) what do you both say to: g3a_renewal_normalparam <- function (
stock,
factor_f = g3_parameterized('rec',
by_stock = by_stock,
by_year = TRUE,
- scale = g3_parameterized(name = 'rec.scalar', by_stock = by_stock),
+ scale = g3_parameterized(
+ name = 'rec.scalar',
+ by_stock = by_stock,
+ by_step = is.null(run_step)),
ifmissing = NaN),
mean_f = g3a_renewal_vonb(by_stock = by_stock),
stddev_f = g3_parameterized('rec.sd', value = 10, by_stock = by_stock),
alpha_f = g3_parameterized('walpha', by_stock = wgt_by_stock),
beta_f = g3_parameterized('wbeta', by_stock = wgt_by_stock),
by_stock = TRUE,
wgt_by_stock = TRUE,
run_age = quote(stock__minage),
run_projection = FALSE,
run_step = 1,
run_f = NULL,
run_at = 8) { ...i.e. if you set This would be needed for the anchovy continuous-renewal-apart-from-in-winter, but seems fairly generally applicable. |
Looks fine to me. If one wants have different recruitment by year and step I assume you just do:
|
Exactly. Or we could make your suggestion the default if you specify continuous recruitment (although it would result in a fair few additional parameters). Either would be useful I'm sure, I guess the question is which would "do the right thing" in more cases. |
Add what should be a more familiar parameterisation of the vonb function, and use it by default instead. Add an explicit g3a_renewal_vonb_recl(), which g3a_renewal_vonb() is an alias for. This way models that use g3a_renewal_vonb() won't change, and you can use g3a_renewal_vonb_recl() explicitly if required.
If renewal is configured to be continuous, then a per-step rec.scalar should be more useful than a fixed scalar.
I think the timestep specific scalar is more appropriate, unless you have too much data lying around (I wish). But I think that it would good to have this as an example in the help page for renewal. |
In retrospect, I'm not convinced doing this automagically is the right way to go, we don't with any other options. Remove this before it becomes relied upon.
See #117 for more discussion - enough parametrized defaults so we can throw together a ~sensible model by just combining actions.
The text was updated successfully, but these errors were encountered: