<< Chapter < Page Chapter >> Page >

The largest absolute value of the eigenvalues (other than one) is 0.1716. Since 0 . 1716 16 5 . 6 · 10 - 13 , we take any row of P 16 as the long-run probabilities. These are included in the matrix PI in the m-file, above.The examples for the various procedures below use this set of artificial data, since the purpose is to illustrate the operation of the procedures.

The setup and the generating m-procedures

The m-procedure chainset sets up for simulation of Markov chains. It prompts for input of the transition matrix P , the states (if different from the state numbers), the long-run distribution (if available), and the set of target states if it isdesired to obtain arrival or recurrence times. The procedure determines the number of states from the size of P and calculates the information needed for the quantile function. It then prompts for a call for one of the generating procedures.

The m-procedure mchain , as do the other generating procedures below, assumes chainset has been run, so that commonly used data are available in appropriate form. The procedure promptsfor the number of stages (length of the trajectory to be formed) and for the initial state. When the trajectory is produced, the various states in the trajectory andthe fraction or relative frequency of each is displayed. If the long-run distribution has been supplied by chainset, this distribution is included for comparison. Inthe examples below, we reset the random number generator (set the “seed” to zero) for purposes of comparison. However, in practice, it may be desirable to makeseveral runs without resetting the seed, to allow greater effective “randomness.”

markovp1 % Call for data chainset % Call for setup procedureEnter the transition matrix P Enter the states if not 1:ms states % Enter the statesStates are 1 102 13 3 164 19 5 226 25 7 288 31 9 3410 37 Enter the long-run probabilities PI % Enter the long-run distributionEnter the set of target states [16 22 25] % Not used with mchainCall for for appropriate chain generating procedure rand('seed',0)mchain % Call for generating procedure Enter the number n of stages 10000 % Note the trajectory lengthEnter the initial state 16 State Frac P0 % Statistics on the trajectory10.0000 0.0812 0.0849 13.0000 0.0952 0.090516.0000 0.1106 0.1125 19.0000 0.1226 0.126822.0000 0.0880 0.0883 25.0000 0.1180 0.114128.0000 0.1034 0.1049 31.0000 0.0814 0.080634.0000 0.0849 0.0881 37.0000 0.1147 0.1093To view the first part of the trajectory of states, call for TR disp(TR')0 1 2 3 4 5 6 7 8 9 10 16 16 10 28 34 37 16 25 37 10 13

The fact that the fractions or relative frequencies approximate the long-run probabilities is an expression of a fundamental limit property of probabilitytheory. This limit property, which requires somewhat sophisticated technique to establish, justifies a relative frequency interpretation of probability.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

Ask