This model agnostic function runs a single markov model for the specified duration. It wraps multiple approaches that may offer various advantages and disadvantages.

simulate_markov(
  markov_sample = NULL,
  duration = NULL,
  discounting = NULL,
  type = "armadillo_all",
  debug = FALSE,
  input_is_list = NULL,
  sim = NULL
)

Arguments

markov_sample

A single row dataframe or a list with no default. See sample_markov for the correct data format.

duration

Numeric, how many long to run the model for.

discounting

Numeric vector, the discount that should be applied to the costs and QALYs for each time period. This must be the same length as duration.

type

A character string specifying the approach to use to simulate the model. Currently implemented approaches are "base", "armadillo_inner" and "armadillo_all with "armadillo_inner" as the default. "armadillo_all" is likely to be generally faster but has a slightly reduced feature set.

debug

Logical, defaults to FALSE. Turns on all debug checks - this may impact runtimes.

input_is_list

Logical defaults to NULL. What type of input is markov_sample? A list or a dataframe. If not given then the input type will be checked and converted to a list as required.

sim

Matrix with the same number of rows as the duration of the model and the same number of columns as the number of states in the model. Used to store model simulations.

Value

A list containing total costs and total QALYs as matrices across states and the duration of the model

Examples

sample <- sample_markov(example_two_state_markov()) simulate_markov(sample[1, ], duration = 10, discounting = SpeedyMarkov::calc_discounting(1.035, 10))
#> $total_costs #> [1] 0 #> #> $total_qalys #> [1] 4.190831 #>