estimateTransitionProb: Estimate transition probability from a sequence of integers

View source: R/estimateTransitionProb.R

estimateTransitionProbR Documentation

Estimate transition probability from a sequence of integers

Description

This function estimates the transition probabilities for a k-state Markov chain based on a sequence of integers that represent states of the chain

Usage

estimateTransitionProb(chain, numStates)

Arguments

chain

a vector of integers

numStates

an integer, the number of states in the Markov chain

Value

A k-by-k matrix of transition probabilities, such that k is the number of states of the chain

References

https://github.com/plbaldoni/epigraHMM

Examples


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


plbaldoni/epigraHMM documentation built on Oct. 15, 2023, 7:53 p.m.