Closed vbartolino closed 1 week ago
This is where the stock_re column comes in, if you replace the stock column in the above with stock_re = c('^ven_', 'otherfood')
, then you'll compare against an aggregate of ven_imm
& ven_mat
.
If I'm not mistaken you can use regex by using the stockre column, instead of stock, and specifying the prey stock as "ven*" to capture both "ven_imm" and "ven_mat".
Snap :)
Maybe it'd be nicer to say stock_alias = list(vendace = c('ven_imm', 'ven_mat'))
somewhere separate to the data, but the stock_re column is how to do it today.
This is where the stock_re column comes in
brilliant! thanks
Yes, or figure out a way to use the stock name parts in the likelihood.
Using the stock name parts is easily do-able actually---I think the stock_re mechanism predates name parts, which is why we ended up with it.
The only downside is that you might be mislead into having a stock column with both ven
& ven_imm
, which won't do what you want (ven_imm won't be duplicated across both), but that's already a problem with stock_re anyway.
when making the likelihood for the prey size composition in the stomachs I find that g3l_catchdistribution
complains when the prey length groups are defined with "len"
preyLenGrp <- mfdb_interval("len", seq(...
...
> g3l_catchdistribution(
+ 'rin_stom_ven_len',
+ rin.stom.ven.len,
+ fleets = pred_stocks,
+ # NB: Only referenceing stocks included in observation data
+ stocks = list(stocks_ven[[1]], stocks_ven[[2]]),
+ g3l_distribution_sumofsquares(),
+ nll_breakdown = TRUE,
+ report = TRUE )
Error in stop("Unknown form of ", var_name, " levels, see ?cut for formatting: ", :
argument "var_name" is missing, with no default
while I've no problem with
preyLenGrp <- mfdb_interval("", seq(...
g3l_catchdistribution
does not complain in the same way for the predator_length
Are you renaming the column from MFDB, but not renaming the attribute? It's not found the "length" attribute, and falling back to trying to parse the column character values.
gadget3:::parse_levels
() doesn't know how to parse columns with "len(x)" in, we could add it admittedly, but then we'd loose the upper value that MFDB may have set.
Are you renaming the column from MFDB, but not renaming the attribute?
yes, that must be the problem. I was doing that because g3l_catchdistribution
was complaining for the column name prey_length
I'm unsure about an equivalent of the g2 prey aggregation file to be used when specifying the stomach likelihood.
In practice, one of the stomach likelihoods will focus on prey species composition in the stomachs, and we need to tell the model that some preys are the results of aggregating several g3_stock. For instance,
vendace
in the dataset below would be the aggregation ofven_imm
andven_mat