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 )
markov_sample | A single row dataframe or a list with no default. See |
---|---|
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 |
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 |
input_is_list | Logical defaults to NULL. What type of input is |
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. |
A list containing total costs and total QALYs as matrices across states and the duration of the model
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 #>