View source: R/sequence-networks.R
| fit_higher_order_transition_model | R Documentation |
Fit a higher-order transition model
fit_higher_order_transition_model(
data,
sequence_id_col = "sequence_id",
order_col = "sequence_order",
state_col = "state",
order = 2L,
smoothing = 0.5,
backoff = TRUE,
context_separator = " > "
)
data |
Long-format sequence data. |
sequence_id_col, order_col, state_col |
Sequence columns. |
order |
Context order. |
smoothing |
Additive smoothing over observed next states. |
backoff |
Retain lower-order context tables for prediction backoff. |
context_separator |
Context separator. |
An object of class gp3_higher_order_transition_model.
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_higher_order_transition_model(sequences, order = 2L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.