Estimates the transition matrix and stationary distribution of a first-order Markov chain from an observed sequence of symbols.

1 | ```
estimateMarkovChain(x, circular=TRUE)
``` |

`x` |
The sequence of observed symbols as a character vector. |

purposes

`circular` |
Should the sequence be treated as circular for the purpose of estimation? The default is TRUE. |

A list with class FiniteStateMarkovChain having the following components:

`trans.mat` |
The stochastic transition matrix estimated from x. |

`stat.dist` |
The stationary distribution estimated from x. |

`states` |
the state labels |

Andrew Hart and Servet Mart<ed>nez

`markov.test`

, `markov.disturbance`

, `simulateMarkovChain`

1 2 3 4 5 6 7 8 9 | ```
#Obtain a random 3 x 3 stochastic matrix with rows and columns labelled "A", "B", "C"
mat <- rstochmat(3, labels=c("A", "B", "C"))
mat
#Simulate a Markov chain of length 500 using mat as the transition matrix
seq <- simulateMarkovChain(500, mat)
#Estimate mat and the stationary distribution for the Markov chain which generated seq
estimateMarkovChain(seq)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.