Skip to content
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

Growth function oddness #104

Open
bthe opened this issue Jan 30, 2023 · 1 comment
Open

Growth function oddness #104

bthe opened this issue Jan 30, 2023 · 1 comment

Comments

@bthe
Copy link
Collaborator

bthe commented Jan 30, 2023

When poking the growth equation I noticed an oddity that I hadn't thought about before. When the beta-binomial (implemented at https://github.com/gadget-framework/gadget3/blob/master/R/action_grow.R#L66 ) is supplied with a delta_l > binn the sum of the entries is no longer 1, e.g.

sum(growth_bbinom(10,1,1000))

results in 19, and thus could lead to increasing the number of fish in the model. Although I guess this is not very likely to occur in a final model, as it is common practice to set this value roughly as the maximum possible growth, we should probably think of something to ensure that this does not cause problems.

@lentinj
Copy link
Collaborator

lentinj commented Jan 31, 2023

FWIW you can reproduce this with the real thing via:

g3_eval(gadget3:::g3a_grow_impl_bbinom(
    delta_len_f = 10,
    delta_wgt_f = NA,
    beta_f = 1000,
    maxlengthgroupgrowth = 1)$len, list(stock__plusdl = 1))

as it is common practice to set this value roughly as the maximum possible growth,

I think there's some naming muddling here, which isn't helping.

gadget3/R/action_grow.R

Lines 57 to 61 in f21bdc9

g3a_grow_impl_bbinom <- function (
delta_len_f, delta_wgt_f,
beta_f = g3_parameterized('bbin', by_stock = by_stock),
maxlengthgroupgrowth,
by_stock = TRUE) {

gadget3/R/action_grow.R

Lines 63 to 66 in f21bdc9

##' @param delt_l Vector, for each lengthgroup, mean # of length groups to grow by
##' @param binn Maximum possible number of length groups to grow by
##' @return length(delt_l) x (length(delt_l) + 1) 2-dimensional array, initial_len -> growth jump
growth_bbinom <- g3_native(r = function (delt_l, binn, beta) {

~growth_bbinom(avoid_zero_vec((delta_len_f) / stock__plusdl), maxlengthgroupgrowth, avoid_zero(beta_f)),

binn within growth_bbinom() is always maxlengthgroupgrowth. But we make a default parameter for beta_f called "stock_name.binn".

@lentinj lentinj closed this as completed Aug 4, 2023
@lentinj lentinj reopened this Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants