flexmodel: Initialize Flexible Compartmental Model

View source: R/tmb.R

flexmodelR Documentation

Initialize Flexible Compartmental Model

Description

https://canmod.net/misc/flex_specs

Usage

flexmodel(
  params,
  state = NULL,
  start_date = NULL,
  end_date = NULL,
  params_timevar = NULL,
  do_hazard = getOption("MP_default_do_hazard"),
  do_make_state = getOption("MP_default_do_make_state"),
  do_hazard_lin = getOption("MP_default_do_hazard_lin"),
  do_approx_hazard = getOption("MP_default_do_approx_hazard"),
  do_approx_hazard_lin = getOption("MP_default_do_approx_hazard_lin"),
  do_sim_constraint = getOption("MP_default_do_sim_constraint"),
  sim_lower_bound = getOption("MP_default_sim_lower_bound"),
  max_iters_eig_pow_meth = 8000,
  tol_eig_pow_meth = 1e-06,
  data = NULL,
  ...
)

init_model(...)

Arguments

params

a param_pansim object

state

a state_pansim object

start_date

simulation start date

end_date

simulation end date

params_timevar

data frame with scheduling for piece-wise constant parameter variation (TODO: direct to other help pages)

do_hazard

should hazard simulation steps be used? (https://canmod.net/misc/flex_specs#v0.0.5) – only used if spec_ver_gt('0.0.4')

do_make_state

should state be remade on the c++ size? (https://canmod.net/misc/flex_specs#v0.1.1) – only used if spec_ver_gt('0.1.0')

do_hazard_lin

like do_hazard but for the linearized model that is used to construct the initial state variable – only used when do_make_state == TRUE

do_approx_hazard

approximate the hazard transformation by a smooth function (experimental)

do_approx_hazard_lin

like do_approx_hazard but for the linearized model that is used to construct the initial state (experimental)

do_sim_constraint

should simulated values be smoothly constrained to be above sim_lower_bound when computing negative binomial (maybe others in the future?) loss functions? the smooth constraint function is y = x + \epsilon * \exp(-x / \epsilon), where \epsilon is sim_lower_bound and x is the simulated value.

sim_lower_bound

optional lower bound on the simulated values when computing negative binomial loss functions (only applicable when do_sim_constraint is TRUE.

max_iters_eig_pow_meth

maximum number of iterations to use in computing the eigenvector for initial state construction

tol_eig_pow_meth

tolerance for determining convergence of the power method used in initial state construction

data

optional observed data frame in long format to compare with simulated trajectories. must have the following columns: date, var, value. (currently this is not working)

Value

flexmodel object representing a compartmental model

See Also

Other flexmodels: make_ageified_model(), make_base_model(), make_hello_world_model(), make_omicron_model(), make_sir_model(), make_vaccination_model()


bbolker/McMasterPandemic documentation built on Aug. 25, 2024, 6:35 p.m.