This model agnostic function samples a markov model specification. It wraps multiple approaches that may offer various advantages and disadvantages.

sample_markov(markov_model = NULL, type = "rcpp", debug = FALSE, samples = 1)

Arguments

markov_model

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

type

A character string specifying the approach to use to sample the model. Currently implemented approaches are "base" and "rcpp" with "rcpp" as the default.

debug

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

samples

Numeric, defaults to 1. The number of samples to take from the Markov model

Value

A data.frame of samples of a model encoded in the SpeedyMarkov format (see example_two_state_markov for details).

Examples

sample <- sample_markov(example_two_state_markov()) sample
#> # A tibble: 2 x 7 #> sample intervention transition state_cost intervention_co… cohort qalys #> <int> <chr> <named list> <named lis> <dbl> <named> <name> #> 1 1 SoC <dbl[,2] [2… <dbl [2]> 0 <dbl [… <dbl … #> 2 1 Soc with Webs… <dbl[,2] [2… <dbl [2]> 50 <dbl [… <dbl …