@@ -254,50 +254,59 @@ must_save_time_args = function(formulas) {
254254# ' Specify a simulation model in the TMB engine. A detailed explanation of this
255255# ' function is covered in `vignette("quickstart")`.
256256# '
257- # ' @param before List of expressions to be evaluated (in the order provided)
258- # ' before the simulation loop begins. Expressions can either be standard
259- # ' R \code{\link{formula}} objects or calls to flow functions (e.g.,
260- # ' \code{\link{mp_per_capita_flow}}). Formulas must have a left hand
261- # ' side that gives the name of the matrix being updated, and a right hand side
262- # ' giving an expression containing only (1) the names of quantities in the
263- # ' model, (2) functions defined in the TMB engine, and (3) numerical literals
264- # ' (e.g., \code{3.14}). The available functions in the TMB engine can be
265- # ' described in \code{\link{engine_functions}}. Names can be provided for the
266- # ' components of \code{before}, and these names do not have to be unique. These
267- # ' names are used by the \code{sim_exprs} argument.
257+ # ' @param before List of formulas to be evaluated (in the order provided)
258+ # ' before the simulation loop begins. These formulas must be standard
259+ # ' two-sided R \code{\link{formula}} objects. See `details` below for the
260+ # ' rules for these formulas.
268261# ' @param during List of formulas or calls to flow functions (e.g.,
269262# ' \code{\link{mp_per_capita_flow}}) to be evaluated at every iteration of the
270- # ' simulation loop, with the same rules as \code{before}.
271- # ' @param after List of formulas or calls to flow functions (e.g.,
272- # ' \code{\link{mp_per_capita_flow}}) to be evaluated after the simulation loop,
273- # ' with the same rules as \code{before}.
263+ # ' simulation loop.
264+ # ' @param after List of formulas to be evaluated (in the order provided)
265+ # ' before the simulation loop begins. These formulas must be standard
266+ # ' two-sided R \code{\link{formula}} objects. See `details` below for the
267+ # ' rules for these formulas.
274268# ' @param default Named list of objects, each of which can be coerced into
275269# ' a \code{\link{numeric}} \code{\link{matrix}}. The names refer to
276270# ' variables that appear in \code{before}, \code{during}, and \code{after}.
277271# ' @param integers Named list of vectors that can be coerced to integer
278272# ' vectors. These integer vectors can be used by name in model formulas to
279273# ' provide indexing of matrices and as grouping factors in
280274# ' \code{\link{group_sums}}.
281- # ' @param must_save Character vector of the names of matrices that must have
275+ # ' @param must_save Character vector of the names of variables that must have
282276# ' their values stored at every iteration of the simulation loop. For example,
283- # ' a matrix that the user does not want to be returned but that impacts dynamics
284- # ' with a time lag must be saved and therefore in this list.
285- # ' @param must_not_save Character vector of the names of matrices that must
277+ # ' a variable that you do not want to be returned, but that impacts
278+ # ' dynamics with a time lag, must be saved and therefore must be in this list.
279+ # ' @param must_not_save Character vector of the names of variables that must
286280# ' not have their values stored at every iteration of the simulation loop. For
287281# ' example, the user may ask to return a very large matrix that would create
288282# ' performance issues if stored at each iteration. The creator of the model
289- # ' can mark such matrices making it impossible for the user of the model to
283+ # ' can mark such variables making it impossible for the user of the model to
290284# ' save their full simulation history.
291285# ' @param sim_exprs Character vector of the names of \code{before},
292286# ' \code{during}, and \code{after} expressions that must only be evaluated
293287# ' when simulations are being produced and not when the objective function is
294288# ' being evaluated. For example, expressions that generate stochasticity should
295289# ' be listed in \code{sim_exprs} because TMB objective functions must be
296290# ' continuous.
297- # ' @param state_update (experimental) Optional character vector for how to
298- # ' update the state variables when it is relevant. Options include `"euler"`,
291+ # ' @param state_update Optional character vector for how to update the state
292+ # ' variables when it is relevant. Options include `"euler"` (the default) ,
299293# ' `"rk4"`, and `"euler_multinomial"`.
300294# '
295+ # ' @details
296+ # ' Expressions in the `before`, `during`, and `after` lists can be standard
297+ # ' R \code{\link{formula}} objects for defining variables in the model. These
298+ # ' formulas must have a left hand side that gives the name of the (possibly
299+ # ' matrix-valued) variable being updated, and a right hand side giving an
300+ # ' expression containing only (1) the names of quantities in the model, (2)
301+ # ' numerical literals (e.g., \code{3.14}), or (3) functions defined in the TMB
302+ # ' engine (described in \code{\link{engine_functions}}). For example, the
303+ # ' expression `N ~ S + I + R` updates the value of `N` to be the sum of the
304+ # ' variables `S`, `I`, and `R`.
305+ # '
306+ # ' Names can be provided for the components of the `before`, `during`, and
307+ # ' `after` lists, and these names do not have to be unique. These names are
308+ # ' used by the \code{sim_exprs} argument.
309+ # '
301310# ' @examples
302311# ' ## A simple SI model.
303312# ' spec = mp_tmb_model_spec(
@@ -337,8 +346,6 @@ must_save_time_args = function(formulas) {
337346# ' |> mp_trajectory()
338347# ' )
339348# '
340- # '
341- # '
342349# ' @concept create-model-spec
343350# ' @export
344351mp_tmb_model_spec = TMBModelSpec
0 commit comments