This functions wraps multiple modular functions and allows an end-to-end cost effectiveness to be run, excluding the final analysis of the findings. It may also be used in batch mode to run analyses in parallel.

markov_simulation_pipeline(
  markov_model = NULL,
  duration = NULL,
  discount = 1.035,
  samples = 1,
  sample_type = "rcpp",
  sim_type = "armadillo_all",
  batches = 1,
  batch_fn = NULL,
  debug = FALSE,
  ...
)

Arguments

markov_model

A list of functions that define a markov model across multiple interventions. See example_two_state_markov for the correct format.

duration

Numeric, how many long to run the model for.

discount

Numeric, the discount that should be applied to the costs and QALYs. Defaults to 1.035.

samples

Numeric, defaults to 1. The number of markov model samples to use.

sample_type

A character string specifying the approach to use to sample the model. Options and defaults inherited from sample_markov.

sim_type

A character string specifying the approach to use to simulate the model. Options and defaults inherited from simulate_markov.

batches

Numeric, defaults to 1. The number of batches to run simulation/sampling in. When set to values greater than 1 a batch_fn must also be supplied. It is likely that the most efficient option will be to use a batch number that corresponds to the number of cores being utilised.

batch_fn

Function, defaults to NULL. This is the function to be used to parallise across batches. Potential options include parallel::mclapply (not Windows) or furrr::future_map (requires the use of future::plan outside the function). When not given the function will default to using no batching.

debug

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

...

Additional options to pass to batch_fn. For example this may be the mc.cores argument of parallel::mclapply.

Value

A list containing the model samples and simulations.

See also

sample_markov simulate_markov

Examples

markov_simulation_pipeline(example_two_state_markov(), duration = 10, samples = 2)
#> # A tibble: 4 x 9 #> sample intervention transition state_cost intervention_co… cohort qalys #> <int> <chr> <named li> <named li> <dbl> <name> <nam> #> 1 1 SoC <dbl[,2] … <dbl [2]> 0 <dbl … <dbl… #> 2 1 Soc with We… <dbl[,2] … <dbl [2]> 50 <dbl … <dbl… #> 3 2 SoC <dbl[,2] … <dbl [2]> 0 <dbl … <dbl… #> 4 2 Soc with We… <dbl[,2] … <dbl [2]> 50 <dbl … <dbl… #> # … with 2 more variables: total_costs <dbl>, total_qalys <dbl>