expand_if_necessary: Expand States and Transition

Description Usage Arguments Details Value Examples

View source: R/strategy_eval.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
)

heemod documentation built on July 8, 2020, 6:55 p.m.