Activities

Markov chains - simulation


Consider the example in the notes. The two states are "wet" and "dry".

To move from one day to the next, use a random number generator to produce a number between 0 and 1.
 

If today is wet:
  • if the number is less than 0.8, then tomorrow will be wet
  • if the number is 0.8 or larger, then tomorrow will be dry.
If today is dry:
  • if the number is less than 0.3, then tomorrow will be wet
  • if the number is 0.3 or larger, then tomorrow will be dry.

Keep a tally of the number of hits on each state and calculate the experimental probabilities for each state.


Simulations involving up to four states can be performed with a simulator from Hofstra University.

Perform a large number of iterations and compare the experimental probabilities for each state with the theoretical long term probabilities.