transition | R Documentation |
Calculates individual transition probabilities/counts
or a complete transition matrix
for an EMM (which contains "TRACDS"
).
## S4 method for signature 'TRACDS,character,character'
transition(x, from, to,
type = c("probability", "counts", "log_odds"), prior = TRUE)
## S4 method for signature 'TRACDS'
transition_matrix(x,
type = c("probability", "counts", "log_odds"), prior = TRUE)
## S4 method for signature 'TRACDS'
initial_transition(x,
type = c("probability", "counts", "log_odds"), prior = TRUE)
x |
an object of class |
from , to |
Names a states. If |
type |
What should be calculated? |
prior |
add one to each transition count. This is equal to starting with a uniform prior for the transition count distribution, i.e., initially all transitions are equally likely. |
Log odds are calculated as ln(a/(1/n))
where a
is the probability
of the transition and n
is the number of states in the EMM. 1/n
is
the probability of a transition under the null model which assumes that the
transition probability from each state to each other state (including staying
in the same state) is the same, i.e., the null model has a transition matrix
with all entries equal to 1/n
.
A scalar (for transition
), a square matrix
(for transition_matrix
) or a vector (for initial_transition
).
EMM
which contains
TRACDS
data("EMMTraffic")
emm <- EMM(measure="eJaccard", threshold=0.2)
emm <- build(emm, EMMTraffic)
## get transition matrix
transition_matrix(emm, type="count", prior=FALSE)
transition_matrix(emm, type="count")
transition_matrix(emm, prior=FALSE)
transition_matrix(emm)
## get initial state probabilities
initial_transition(emm)
## access individual transition probability (state 1 -> 2)
transition(emm, "1","2")
## get counts for all existing transitions
tr <- transitions(emm)
tr
cbind(as.data.frame(tr), counts=transition(emm, tr, type="counts"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.