View source: R/estimateTransitionProb.R
estimateTransitionProb | R Documentation |
This function estimates the transition probabilities for a k-state Markov chain based on a sequence of integers that represent states of the chain
estimateTransitionProb(chain, numStates)
chain |
a vector of integers |
numStates |
an integer, the number of states in the Markov chain |
A k-by-k matrix of transition probabilities, such that k is the number of states of the chain
https://github.com/plbaldoni/epigraHMM
trueMat <- matrix(c(0.9,0.1,0.1,0.9),2,2)
simChain <- simulateMarkovChain(trueMat,1e3)
estMat <- estimateTransitionProb(simChain,2)
# estMat should be close to trueMat
estMat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.