Access Transition Probabilities/Counts in an EMM
Calculates individual transition probabilities/counts
or a complete transition matrix
for an EMM (which contains
"transition"(x, from, to, type = c("probability", "counts", "log_odds"), prior = TRUE) "transition_matrix"(x, type = c("probability", "counts", "log_odds"), prior = TRUE) "initial_transition"(x, type = c("probability", "counts", "log_odds"), prior = TRUE)
- an object of class
- from, to
- Names a states. If
fromhas to contain a matrix with two columns (a from column and a to column as returned by
- What should be calculated?
- 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
EMM which contains
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"))