<< Chapter < Page Chapter >> Page >

Arrival times and recurrence times

The basic simulation produces one or more trajectories of a specified length. Sometimes we are interested in continuing until first arrival at (or visit to)a specific target state or any one of a set of target states. The time (in transitions) to reach a target state is one less than the number of stages in the trajectory whichbegins with the initial state and ends with the target state reached.

  • If the initial state is not in the target set, we speak of the arrival time .
  • If the initial state is in the target set, the arrival time would be zero. In this case, we do not stop at zero but continue until the next visit to a target state (possiblythe same as the initial state). We call the number of transitions in this case the recurrence time .
  • In some instances, it may be desirable to know the time to complete visits to a prescribed number of the target states. Again there is a choice of treatment in thecase the initial set is in the target set.

Data files

For use of MATLAB in simulation, we find it convenient to organize the appropriate data in an m-file.

  • In every case, we need the transition matrix P . Its size indicates the number of states (say by the length of any row or column).
  • If the states are to have values other than the state numbers, these may be included in the data file, although they may be added later, in response to a prompt.
  • If long trajectories are to be produced, it may be desirable to determinethe fraction of times each state is realized. A comparison with the long-run probabilities for the chain may be of interest. In this case, the data file maycontain the long-run probability distribution. Usually, this is obtained by taking one row of a sufficiently large power of the transition matrix. This operationmay be performed after the data file is called for but before the simulation procedure begins.

An example data file used to illustrate the various procedures is shown below. These data were generated artificially and have no obvious interpretations in terms of aspecific systems to be modeled. However, they are sufficiently complex to provide nontrivial illustrations of the simulation procedures.

% file markovp1.m % Artificial data for a Markov chain, used to% illustrate the operation of the simulation procedures. P = [0.050 0.011 0.155 0.155 0.213 0.087 0.119 0.190 0.008 0.0120.103 0.131 0.002 0.075 0.013 0.081 0.134 0.115 0.181 0.165 0.103 0.018 0.128 0.081 0.137 0.180 0.149 0.051 0.009 0.1440.051 0.098 0.118 0.154 0.057 0.039 0.153 0.112 0.117 0.101 0.016 0.143 0.200 0.062 0.099 0.175 0.108 0.054 0.062 0.0810.029 0.085 0.156 0.158 0.011 0.156 0.088 0.090 0.055 0.172 0.110 0.059 0.020 0.212 0.016 0.113 0.086 0.062 0.204 0.1180.084 0.171 0.009 0.138 0.140 0.150 0.023 0.003 0.125 0.157 0.105 0.123 0.121 0.167 0.149 0.040 0.051 0.059 0.086 0.0990.192 0.093 0.191 0.061 0.094 0.123 0.106 0.065 0.040 0.035];states = 10:3:37; PI = [0.0849 0.0905 0.1125 0.1268 0.0883 0.1141 ...0.1049 0.0806 0.0881 0.1093]; % Long-run distribution

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