Here is a little on-line Javascript simulation of a 4-state (or smaller) Markov process. It shows the state transitions graphically, records the number (and relative frequency) of hits at each state, and also counts the number of steps to absorption when an absorbing state is encountered.
To run the simulation, just enter the probabilities in the transition matrix (use the tab key to switch from cell to cell; you can enter the probabilities in integer, decimal, or fraction form), edit the remaining settings if you like, and press "Run."
Note: To simulate a Markov system with fewer than 4 states, fill in the the top left portion of the transition matrix and leave the rest blank. For instance, to simulate a 2-state process, use the top left 2 2 portion of the matrix.
(We leave it to you to check that the entries in each row add up to 1. If they do not, upredictable things may happen.. As for the speed, that depends on how fast you want the simulation to run. Experiment with it. Fractional settings are permiitted.)
State Transition Matrix | State Transition Diagram |
|
State 1 Hits | State 2 Hits | State 3 Hits | State 4 Hits |
State 1 Prob. | State 2 Prob. | State 3 Prob. | State 4 Prob. |
Absorption Occured in Step #: