Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

This 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.
Packages and functions you may need to use (click will lead you to the webpages):
numpy.shape
numpy.random.choice (The input parameter p of this function allows you to provide a probability
distribution over possible choices)
range
list.append
Note: adding comment in each line of code will receive one extra point given that code runs correctly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago