Copies a complete SBT parameter list for every row of a grid and inserts the
fixed, natural-scale grid coordinates on their model log scales. Unlike
get_grid(), the grid layout is supplied directly and can therefore retain
explicit cell identifiers and assessment-specific coordinate ordering.
Usage
make_mle_grid_parameters(
grid,
parameters,
parameter_columns = c(h = "par_log_h", psi = "par_log_psi", m0 = "par_log_m0", m10 =
"par_log_m10"),
cell_column = "Cell",
allow_new_parameters = TRUE
)Arguments
- grid
A non-empty data frame with one row per grid cell.
- parameters
A named model parameter list.
- parameter_columns
Named character vector mapping natural-scale grid columns to log-scale model parameter names.
- cell_column
Name of the optional grid column containing unique, positive integer cell identifiers.
- allow_new_parameters
Logical; allow a mapped grid coordinate to be added when it is absent from the template parameter list. This is needed for nominal coordinates such as M0 under the length-based mortality model.
Examples
fit <- sbt_fit(sbt_example_data())
fit <- sbt_add_parameters(fit)
grid <- expand.grid(
h = c(0.55, 0.63, 0.72, 0.80),
psi = c(1.50, 1.75, 2.00),
m0 = c(0.40, 0.45, 0.50),
m10 = c(0.065, 0.085, 0.105)
)
grid$Cell <- seq_len(nrow(grid))
grid_parameters <- make_mle_grid_parameters(grid, fit$parameters)
length(grid_parameters)
#> [1] 108
