Generating Markov chains of order 1,2,3,...
When the matrix of transition probabilities is given as a Survo matrix file,
samples of the chain may be generated
either by the MARKOV command of the form
MARKOV L1,L2 BY P
where P is the transition matrix and L1 is the first line and L2 the
last line for the generated sequence (see example on the next page)
or by a special form of the TRANSFORM operation (see MARKOVD?).
The following tutorial shows more examples:
/MARKOV-DEMO2
Generating a Markov chain of order 3 with two states A,B:
MATRIX P82
/// A B
AAA 0 1
AAB 0.5 0.5
ABA 0.3 0.7
ABB 0.9 0.1
BAA 0 1
BAB 0.5 0.5
BBA 0.2 0.8
BBB 0.1 0.9
MAT SAVE P82 / Saving the matrix of transition probabilities
MARKOV CUR+1,CUR+5 BY P82 / Generate a sample to next 5 lines!
BABABABABBAABBABABBABBABABAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABAABBAABABBAA
BBABBABBABAABBABBABBABABBAABABBABABAABBABBABABABABAABABAABABABABABABBBB
BBBBBBAABABABBABAABBABAABBAABBAABABBABBABABABBBBBBBBBBBBABBABAABAABBABB
BBBBBBBBBBBBABBAABABBABBAABBABABABAABBABABABABBABBABAABBAABAABAABABABAA
BABBABBAABBABBABABBAABBABBABBABABABAABABBABABBABBABBABAABAABAABBABBABBA
H = More information on Markov chains of higher order