View source: R/sequence-latent-models.R
| fit_sequence_hmm_mixture | R Documentation |
Fits sequence-level mixture components, each containing a categorical HMM. Component membership is a statistical clustering device and should not be interpreted as a substantive latent type without external validation.
fit_sequence_hmm_mixture(
data,
n_components,
n_states,
sequence_id_col = "sequence_id",
order_col = "sequence_order",
state_col = "state",
symbol_levels = NULL,
max_iter = 200L,
inner_initial_iter = 20L,
tolerance = 1e-06,
pseudocount = 1e-06,
seed = 1L
)
data |
Long-format sequence data. |
n_components |
Number of mixture components. |
n_states |
Number of hidden states per component; scalar or vector. |
sequence_id_col, order_col, state_col |
Sequence columns. |
symbol_levels |
Optional symbol ordering. |
max_iter |
Maximum mixture-EM iterations. |
inner_initial_iter |
Initial single-HMM iterations per component. |
tolerance |
Relative log-likelihood tolerance. |
pseudocount |
Smoothing count. |
seed |
Reproducibility seed. |
An object of class gp3_sequence_hmm_mixture.
sequences <- data.frame(
sequence_id = rep(c("s1", "s2", "s3", "s4"), each = 4L),
sequence_order = rep(1:4, times = 4L),
state = c("A", "B", "C", "D", "A", "B", "C", "C",
"D", "C", "B", "A", "D", "C", "A", "A"),
group = rep(c("g1", "g2"), each = 8L),
stringsAsFactors = FALSE
)
fit_sequence_hmm_mixture(sequences, n_components = 2L, n_states = 2L,
max_iter = 5L, inner_initial_iter = 2L, seed = 1L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.