The randmarkov
command generates random walks or creates stochastic matrices.
To generate a random walk, randmarkov takes two arguments:
M, a transition matrix for a Markov chain.
i0, an initial state.
n, a positive integer.
randmarkov(M,i0,n) returns a
a random walk (given as a vector) starting at i0 and
taking n random steps, where each step is a transition with
probabilities given by M.
To create a stochastic matrix, randmarkov takes two arguments:
v, a vector of length p.
i0, the number of transient states.
randmatrix(v,i0) returns a stochastic matrix with
p recurrent loops (given by v) and i0 transient states.