markov function

Fit a Markov model