create_stan_function: Create a Stan's ODE function from an XMILE file

Description Usage Arguments Details Value Examples

Description

create_stan_function returns a string with the code for a Stan's ODE function

Usage

1
2
3
4
5
6
7
create_stan_function(
  filepath,
  func_name,
  pars = NULL,
  override.consts = NULL,
  additional_funs = NULL
)

Arguments

filepath

A string that indicates a path to a file with extension .stmx or .xmile. Vensim files (.mdl) are not xmile files. They must be exported from Vensim with extension .xmile

func_name

A string for naming the ODE function

pars

A character vector that indicates which constants will be considered as parameters in the ODE function

override.consts

A list in which each element is a name-value pair that replaces values of constants.

additional_funs

A vector of strings. Each string corresponds to a user-defined function.

Details

This function extracts the xml from the file specified via filepath to generate the code for an equivalent model in Stan.

Value

A string with the code containing the model's equations in the format required by Stan.

Examples

1
2
path <- system.file("models", "SIR.stmx", package = "readsdr")
create_stan_function(path, "my_model")

readsdr documentation built on Jan. 13, 2021, 11:08 a.m.