Open bthe opened 1 month ago
There isn't an option for overriding the map currently, we use it to set fixed parameters:
But we certainly could, as you suggest.
Another option, as the value column is a list we could also set the value to the name of the controlling parameter. But I'm not sure relying on the value column being a list is a great plan.
Looking closer, TMB's map is useless to us. The mapping is only within a parameter (which could be a vector or array). We can't map 2 separate parameters. The man page even makes this explicit:
More advanced parameter mapping, such as collecting parameters between different vectors etc., must be implemented from the template.
Apart from some very early code, we don't use TMB parameter vectors / arrays, we decided the resultant data.frame is too messy. Maybe we could convert them internally, but this would be a fair bit of fiddling.
The
map
argument inTMB::MakeADFun()
allows us to collect groups of variables to a common value, i.e. estimate them as a single parameter. This could be very useful for us, e.g for the parameters defining initial number at age and time-varying maturity where you sometimes would like to fix them to a single value. Using themap
argument would allow us to do this without having to recompile.Could this be achieved by adding an additional column, defining the parameter group, to the parameters object?