| summarize_transitions | R Documentation |
Count observed transitions in sequence data
summarize_transitions(
data,
id = "id",
period = "period",
state = "state",
normalize = TRUE
)
data |
Long-form sequence data. |
id, period, state |
Column names. |
normalize |
Return row-conditional transition proportions. When
|
A tidy base data.frame with one row per observed from/to pair
and columns from, to, count, and probability. Pairs never observed
are absent rather than zero, so probability sums to one within each
from state when normalize is TRUE.
data <- simulate_markov(
n = 40,
transition = matrix(c(0.7, 0.3, 0.4, 0.6), nrow = 2, byrow = TRUE),
chain_length = 20, states = c("A", "B"), seed = 1
)
summarize_transitions(data, normalize = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.