Question: bThis coding exercise is to perform a tiny simulation given a Markov chain transition matrix. Create a Python function named mc simulation that can simulate

bThis coding exercise is to perform a tiny simulation given a Markov chain transition matrix. Create a Python
function named mc simulation that can simulate a history (sequence) of states given any transition matrix. The specific requirements are as follows.
Two inputs: (i) A: a Markov chain transition matrix; (ii) t: the number of steps to simulate. You can
use the row indices [0,1,..., n 1] of matrix A as the set of states.
2
IE 3312 Probabilistic Operations Research
One output: a list of states H =[s0, s1, s2,..., st], where si represents the state occurred at time i in
this simulation. You need to randomly pick an arbitrary state from S as the initial state s0.
Test instance: test your algorithm with inputs S and A being the state set and transition matrix of
Gamblers Ruin (class example) with p =0.52, and use t =10 as the number of simulation steps. Run
five times of your function, and check how is the simulated history of each run.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!