run_model: Run Markov Model

Description Usage Arguments Details Value Examples

View source: R/run_model_define.R

Description

Runs one or more strategy. When more than one strategy is provided, all strategies should have the same states and state value names.

Usage

1
2
3
4
5
6
7
8
run_model(..., parameters = define_parameters(), init = c(1000L, rep(0L,
  get_state_number(get_states(list(...)[[1]])) - 1)), cycles = 1,
  method = "life-table", cost = NULL, effect = NULL,
  state_time_limit = NULL, central_strategy = NULL, inflow = rep(0L,
  get_state_number(get_states(list(...)[[1]]))))

run_model_(uneval_strategy_list, parameters, init, cycles, method, cost, effect,
  state_time_limit, central_strategy, inflow)

Arguments

...

One or more uneval_model object.

parameters

Optional. An object generated by define_parameters().

init

numeric vector or result of define_init(), same length as number of states. Number of individuals in each state at the beginning.

cycles

positive integer. Number of Markov Cycles to compute.

method

Counting method.

cost

Names or expression to compute cost on the cost-effectiveness plane.

effect

Names or expression to compute effect on the cost-effectiveness plane.

state_time_limit

Optional expansion limit for state_time, see details.

central_strategy

character. The name of the strategy at the center of the cost-effectiveness plane, for readability.

inflow

numeric vector or result of define_inflow(), similar to init. Number of new individuals in each state per cycle.

uneval_strategy_list

List of models, only used by run_model_() to avoid using ....

Details

In order to compute comparisons strategies must be similar (same states and state value names). Thus strategies can only differ through transition matrix cell values and values attached to states (but not state value names).

The initial number of individuals in each state and the number of cycle will be the same for all strategies

state_time_limit can be specified in 3 different ways:

  1. As a single value: the limit is applied to all states in all strategies. 2. As a named vector (where names are state names): the limits are applied to the given state names, for all strategies. 3. As a named list of named vectors: the limits are applied to the given state names for the given strategies.

Value

A list of evaluated models with computed values.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# running a single model

mod1 <-
  define_strategy(
    transition = define_transition(
      .5, .5,
      .1, .9
    ),
    define_state(
      cost = 543,
      ly = 1
    ),
    define_state(
      cost = 432,
      ly = 1
    )
  )


res <- run_model(
  mod1,
  init = c(100, 0),
  cycles = 2,
  cost = cost,
  effect = ly
)

# running several models
mod2 <-
  define_strategy(
    transition = define_transition(
      .5, .5,
      .1, .9
    ),
    define_state(
      cost = 789,
      ly = 1
    ),
    define_state(
      cost = 456,
      ly = 1
    )
    
  )


res2 <- run_model(
  mod1, mod2,
  init = c(100, 0),
  cycles = 10,
  cost = cost,
  effect = ly
)

heemod documentation built on May 30, 2017, 7:03 a.m.

Search within the heemod package
Search all R packages, documentation and source code