sample_markov_base: Sample a Markov Model Sample using Base R

Description Usage Arguments Value Examples

View source: R/sample_markov.R

Description

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.

Usage

1
2
3
4
5
6
7
8
9
sample_markov_base(
  transitions = NULL,
  state_costs = NULL,
  intervention_costs = NULL,
  cohorts = NULL,
  qalys = NULL,
  samples = 1,
  type = "rcpp"
)

Arguments

transitions

A function that generates a list of transition matrices, see example_two_state_markov for an example of setting this up.

state_costs

A function that generates a list of state costs for each intervention, see example_two_state_markov for an example of setting this up.

intervention_costs

A function that generates a vector of intervention costs, see example_two_state_markov for an example of setting this up.

cohorts

A function that generates a list containing the initial state for each intervention, see example_two_state_markov for an example of setting this up.

qalys

A function that generates a list of QALYs for each intervention, see example_two_state_markov for an example of setting this up.

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  
  
 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
 ) 
  

seabbs/SpeedyMarkov documentation built on Dec. 26, 2019, 4:38 a.m.