This model agnostic function samples a markov model specification using a base R implementation.
See example_two_state_markov
for an example of the required input. Alternatively use sample_markov(type = "base")
passing the
model specification function.
sample_markov_base( transitions = NULL, state_costs = NULL, intervention_costs = NULL, cohorts = NULL, qalys = NULL, samples = 1, type = "rcpp" )
transitions | A function that generates a list of transition matrices,
see |
---|---|
state_costs | A function that generates a list of state costs for each intervention,
see |
intervention_costs | A function that generates a vector of intervention costs, see |
cohorts | A function that generates a list containing the initial state for each intervention,
see |
qalys | A function that generates a list of QALYs for each intervention, see |
samples | Numeric, defaults to 1. The number of samples to take from the Markov model |
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. |
A data.frame of samples of a model encoded in the SpeedyMarkov
format (see example_two_state_markov
for details).
markov_model <- example_two_state_markov() sample_markov_base( transitions = markov_model$transitions_list, cohorts = markov_model$cohorts, state_costs = markov_model$state_costs, intervention_costs = markov_model$intervention_costs, qalys = markov_model$qalys )#> # 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 …