ode_model: Create an ODE model

View source: R/main-model.R

ode_modelR Documentation

Create an ODE model

Description

Generate model given the declarations of variables, parameters, functions etc. The arguments odefun_vars, loglik_vars and other_vars must be lists whose elements must have one of the following three types:

  • StanDeclaration - can be created using stan_var(), stan_vector(), stan_array() etc.

  • StanParameter - can be created using stan_param()

  • StanTransformation - can be created using stan_transform()

These will go to different blocks of the 'Stan' model code so that

  • StanDeclarations go to data

  • StanParameters go to parameters

  • StanTransformations with origin "data" go to ⁠transformed data⁠

  • StanTransformations with origin "parameters" go to ⁠transformed parameters⁠

  • StanTransformations with origin "model" go to ⁠generated quantities⁠

Usage

ode_model(
  N,
  odefun_vars = list(),
  odefun_body = "",
  odefun_init = NULL,
  loglik_vars = list(),
  loglik_body = "",
  other_vars = list(),
  verbose = FALSE,
  compile = TRUE,
  sig_figs = 18
)

Arguments

N

A StanDimension variable describing the number of time points.

odefun_vars

Data and parameters needed by the ODE function. Must be a list of StanDeclaration, StanParameter, or StanTransformation objects. These will be defined in Stan model code blocks

odefun_body

ODE function body (Stan code string).

odefun_init

Initial value for ODE system at t0. Has to be a StanVector, or alternatively a StanParameter or a StanTransformation with StanVector base declaration.

loglik_vars

Data and parameters needed by the log likelihood function.

loglik_body

Log likelihood function body (Stan code string).

other_vars

Other variables.

verbose

Should this print more information?

compile

Should the model be compiled?

sig_figs

Number of significant figures to use in all 'CmdStan' calls.

Value

An object of class OdeModel.

See Also

Other model constructor functions: example_ode_model()


jtimonen/odemodeling documentation built on Sept. 15, 2024, 4:29 a.m.