| simulate_sequence_clusters | R Documentation |
Simulate sequences from a mixture of transition systems
simulate_sequence_clusters(
n,
transitions,
chain_length,
proportions = NULL,
initial = NULL,
labels = NULL,
states = NULL,
seed = NULL,
batch = NULL
)
n |
Number of sequences. |
transitions |
List of transition matrices, or a tidy data frame with
columns |
chain_length |
Sequence length. |
proportions |
Cluster proportions. When |
initial |
Optional common initial probabilities, shared by every
cluster. When |
labels |
Optional sequence-cluster labels. |
states |
Optional state labels. When the matrices carry no dimnames and
|
seed |
Optional random seed. |
batch |
Optional single positive whole number. When given, the
simulator runs |
A long-form simulab_sim base data.frame with columns id,
period, state, and the true sequence_cluster, one row per sequence
position. A transitions table (sequence_cluster, from, to,
probability) is available through as.data.frame().
# One transition matrix per latent cluster.
result <- simulate_sequence_clusters(
n = 60,
transitions = list(
matrix(c(0.8, 0.2, 0.3, 0.7), nrow = 2, byrow = TRUE),
matrix(c(0.3, 0.7, 0.6, 0.4), nrow = 2, byrow = TRUE)
),
chain_length = 12,
seed = 1
)
head(result)
components(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.