Generate a transition system
Usage
generate_transition_system(
n_states = 8L,
states = NULL,
concentration = 1,
diagonal_concentration = 0,
state_categories = c("metacognitive", "cognitive"),
seed = NULL,
batch = NULL
)Arguments
- n_states
Number of states.
- states
Optional state labels.
- concentration
Dirichlet concentration applied to every transition and to the initial-state probabilities.
- diagonal_concentration
Optional extra concentration added to the self-transition (diagonal) entries only. The default
0leaves self-transitions no more likely than any other transition.- state_categories
Learning-state categories the state labels are drawn from with
sample_learning_states()whenstatesisNULL, defaulting toc("metacognitive", "cognitive"); seelearning_state_categories().NULLlabels the statesState 1,State 2, and so on.- seed
Optional random seed.
- batch
Optional single positive whole number. When given, the simulator runs
batchtimes and returns a plainlistofbatchresults, each exactly what the same call withoutbatchreturns. With aseed, every dataset gets its own seed drawn fromseed, so the whole batch is reproducible; without one the datasets are consecutive draws from the session's random-number stream. The defaultNULLreturns a single result.
Value
A tidy transition-edge simulab_sim base data.frame with
n_states^2 rows and columns from, to, and probability; every
from state's probabilities sum to one. An initial_probabilities table
(state, probability) is available through as.data.frame().
Examples
result <- generate_transition_system(n_states = 3, seed = 1)
result
#> <simulab_sim:transition_system> 9 rows x 3 columns
#> from to probability
#> 1 Reflect Reflect 0.07830127
#> 2 Learn Reflect 0.55164885
#> 3 Plan Reflect 0.59019469
#> 4 Reflect Learn 0.42202656
#> 5 Learn Learn 0.35827360
#> 6 Plan Learn 0.37885862
#> 7 Reflect Plan 0.49967217
#> 8 Learn Plan 0.09007756
#> 9 Plan Plan 0.03094669
#>
#> Other tables: initial_probabilities. Read one with as.data.frame(x, what = "initial_probabilities").