transition

0th

Percentile

Access Transition Probabilities/Counts in an EMM

Calculates individual transition probabilities/counts or a complete transition matrix for an EMM (which contains "TRACDS").

Keywords
models
Usage
"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)
Arguments
x
an object of class "EMM"/"TRACDS".
from, to
Names a states. If to is missing, from has to contain a matrix with two columns (a from column and a to column as returned by transitions).
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.
Details

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$.

Value

A scalar (for transition), a square matrix (for transition_matrix) or a vector (for initial_transition).

See Also

EMM which contains TRACDS

Aliases
  • transition
  • transition,TRACDS,character,character-method
  • transition,TRACDS,matrix,missing-method
  • transition,TRACDS,data.frame,missing-method
  • transition_matrix
  • transition_matrix,TRACDS-method
  • initial_transition
  • initial_transition,TRACDS-method
Examples
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"))
Documentation reproduced from package rEMM, version 1.0-11, License: GPL-2

Community examples

Looks like there are no examples yet.