View source: R/strategy_eval.R
expand_if_necessary | R Documentation |
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.
expand_if_necessary( strategy, parameters, cycles, init, method, expand_limit, inflow, strategy_name )
strategy |
An |
parameters |
Optional. An object generated by
|
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 |
strategy_name |
Name of the strategy. |
init
need not be integer. E.g. c(A = 1, B = 0.5, C = 0.1, ...)
.
Expanded states, transitions, input and inflow (if they require expansion; otherwise return inputs unchanged).
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) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.