Skip to contents

Add Markov states to a twig

Usage

states(names, init_probs, max_cycles = NULL)

Arguments

names

... a character vector of Markov state names. They don't need to be included in quotes.

init_probs

... a vector of initial probs, these could be numeric or function names. The functions can depend on the decision and variables in the params list of dataframe. One of these can be leftover for the remaining probability in that event. init_probs must have the same length as state names.

max_cycles

... optional max tunnel lenghts (tunnel length). This defines the duration allowable in each state. If ignored a length of 1 is assumed. #' max_cycles if provided must have the same length as state names.

Value

a twig layer with Markov state names

Examples

states(names = c(H,S,D), 
                 init_probs = c(0.5, prob_fun, leftover),
                 max_cycles = c(1, 2, 1)) 
#> $type
#> [1] "states"
#> 
#> $names
#> [1] "H" "S" "D"
#> 
#> $init_probs
#> [1] 0.5      prob_fun leftover
#> 
#> $max_cycles
#> [1] 1 2 1
#> 
#> $expanded_init_probs
#> [1] "0.5"      "prob_fun" "0"        "leftover"
#> 
#> $cycles_in_states
#> [1] NA  1  2 NA
#> 
#> $repeated_states
#> [1] "H" "S" "S" "D"
#> 
#> $tunneled_states
#> [1] "H"      "S_tnl1" "S_tnl2" "D"     
#>