expand_if_necessary: Expand States and Transition

View source: R/strategy_eval.R

expand_if_necessaryR Documentation

Expand States and Transition

Description

Given an unevaluated strategy, an initial number of individual and a number of cycle to compute, returns the evaluated version of the objects and the count of individual per state per model cycle.

Usage

expand_if_necessary(
  strategy,
  parameters,
  cycles,
  init,
  method,
  expand_limit,
  inflow,
  strategy_name
)

Arguments

strategy

An uneval_strategy object.

parameters

Optional. An object generated by define_parameters().

cycles

positive integer. Number of Markov Cycles to compute.

init

numeric vector, same length as number of model states. Number of individuals in each model state at the beginning.

method

Counting method.

expand_limit

A named vector of state expansion limits.

inflow

Numeric vector, similar to init. Number of new individuals in each state per cycle.

strategy_name

Name of the strategy.

Details

init need not be integer. E.g. c(A = 1, B = 0.5, C = 0.1, ...).

Value

Expanded states, transitions, input and inflow (if they require expansion; otherwise return inputs unchanged).

Examples

param <- define_parameters(
  a = markov_cycle + 1 * 2
)

mat <- define_transition(
  1-1/a, 1/a,
  .1,    .9
)

mod <- define_strategy(
  transition = mat,
  A = define_state(cost = 10),
  B = define_state(cost = 2)
)

heemod:::eval_strategy(
  strategy = mod,
  parameters = param,
  init = define_init(A = 10, B = 5),
  cycles = 5,
  method = "end",
  inflow = define_inflow(A = 0, B = 0),
  strategy_name = "A",
  expand_limit = c(A = 5, B = 5)
)

pierucci/heemod documentation built on July 17, 2022, 9:27 p.m.