Generate data using Markov Chain models in Python

Amir Ali Hashemi
2 min readNov 18, 2023

In this short blog post, you will see one way of producing data from a Discrete Time Markov chain in Python. I will not discuss what Markov chains are, so if you are unfamiliar with them, please take a quick look on the internet. The only library used in the code is numpy.

Now, consider the following Markov chain {Xt, t = 0, 1, 2, . . .} with the transition probability matrix:

--

--

Amir Ali Hashemi

I'm an AI student who attempts to find simple explanations for questions and share them with others