Examples of Markov chains

Short description: Examples of the probabilistic construct

This article contains examples of Markov chains and Markov processes in action.

All examples are in the countable state space. For an overview of Markov chains in general state space, see Markov chains on a measurable state space.

## Contents

* 1 Discrete-time
* 1.1 Board games played with dice
* 1.2 Random walk Markov chains
* 1.2.1 A center-biased random walk
* 1.2.2 Gambling
* 1.3 A model of language
* 1.4 A simple weather model
* 1.4.1 Predicting the weather
* 1.4.2 Steady state of the weather
* 1.5 Stock market
* 2 Continuous-time
* 2.1 A birth–death process
* 3 See also
* 4 References
* 5 External links

## Discrete-time

### Board games played with dice

A game of snakes and ladders or any other game whose moves are determined entirely by dice is a Markov chain, indeed, an absorbing Markov chain. This is in contrast to card games such as blackjack, where the cards represent a 'memory' of the past moves. To see the difference, consider the probability for a certain event in the game. In the above-mentioned dice games, the only thing that matters is the current state of the board. The next state of the board depends on the current state, and the next roll of the dice. It doesn't depend on how things got to their current state. In a game such as blackjack, a player can gain an advantage by remembering which cards have already been shown (and hence which cards are no longer in the deck), so the next state (or hand) of the game is not independent of the past states.

### Random walk Markov chains

#### A center-biased random walk

Consider a random walk on the number line where, at each step, the position (call it x) may change by +1 (to the right) or −1 (to the left) with probabilities:

Pmoveleft=12+12(xc+|x|)

Pmoveright=1−Pmoveleft

(where c is a constant greater than 0)

For example, if the constant, c, equals 1, the probabilities of a move to the left at positions x = −2,−1,0,1,2 are given by 16,14,12,34,56 respectively. The random walk has a centering effect that weakens as c increases.

Since the probabilities depend only on the current position (value of x) and not on any prior positions, this biased random walk satisfies the definition of a Markov chain.

#### Gambling

Suppose that you start with $10, and you wager $1 on an unending, fair, coin toss indefinitely, or until you lose all of your money. If Xn represents the number of dollars you have after n tosses, with X0=10, then the sequence {Xn:n∈ℕ} is a Markov process. If I know that you have $12 now, then it would be expected that with even odds, you will either have $11 or $13 after the next toss. This guess is not improved by the added knowledge that you started with $10, then went up to $11, down to $10, up to $11, and then to $12. The fact that the guess is not improved by the knowledge of earlier tosses showcases the Markov property, the memoryless property of a stochastic process.[1][2]

### A model of language

This example came from Markov himself.[3] Markov chose 20,000 letters from Pushkin’s Eugene Onegin, classified them into vowels and consonants, and counted the transition probabilities.vowelconsonantvowel.128.872consonant.663.337The stationary distribution is 43.2 percent vowels and 56.8 percent consonants, which is close to the actual count in the book.[4]

### A simple weather model

The probabilities of weather conditions (modeled as either rainy or sunny), given the weather on the preceding day, can be represented by a transition matrix:[5]

P=[0.90.10.50.5]

The matrix P represents the weather model in which a sunny day is 90% likely to be followed by another sunny day, and a rainy day is 50% likely to be followed by another rainy day.[5] The columns can be labelled "sunny" and "rainy", and the rows can be labelled in the same order.

The above matrix as a graph.

(P)i j is the probability that, if a given day is of type i, it will be followed by a day of type j.

Notice that the rows of P sum to 1: this is because P is a stochastic matrix.[5]

#### Predicting the weather

The weather on day 0 (today) is known to be sunny. This is represented by an initial state vector in which the "sunny" entry is 100%, and the "rainy" entry is 0%:

𝐱(0)=[10]

The weather on day 1 (tomorrow) can be predicted by multiplying the state vector from day 0 by the transition matrix:

𝐱(1)=𝐱(0)P=[10][0.90.10.50.5]=[0.90.1]

Thus, there is a 90% chance that day 1 will also be sunny.

The weather on day 2 (the day after tomorrow) can be predicted in the same way, from the state vector we computed for day 1:

𝐱(2)=𝐱(1)P=𝐱(0)P2=[10][0.90.10.50.5]2=[0.860.14]

𝐱(2)=𝐱(1)P=[0.90.1][0.90.10.50.5]=[0.860.14]

General rules for day n are:

𝐱(n)=𝐱(n−1)P

𝐱(n)=𝐱(0)Pn

#### Steady state of the weather

In this example, predictions for the weather on more distant days change less and less on each subsequent day and tend towards a steady state vector.[6] This vector represents the probabilities of sunny and rainy weather on all days, and is independent of the initial weather.[6]

The steady state vector is defined as:

𝐪=limn->∞𝐱(n)

but converges to a strictly positive vector only if P is a regular transition matrix (that is, there is at least one Pn with all non-zero entries).

Since q is independent from initial conditions, it must be unchanged when transformed by P.[6] This makes it an eigenvector (with eigenvalue 1), and means it can be derived from P.[6]

In layman's terms, the steady-state vector is the vector that, when we multiply it by P, we get the exact same vector back.[7] For the weather example, we can use this to set up a matrix equation:

P=[0.90.10.50.5]𝐪P=𝐪(𝐪 is unchanged by P.)=𝐪I𝐪(P−I)=𝟎𝐪([0.90.10.50.5]−[1001])=𝟎𝐪[−0.10.10.5−0.5]=𝟎[q1q2][−0.10.10.5−0.5]=[00]−0.1q1+0.5q2=0

and since they are a probability vector we know that

q1+q2=1.

Solving this pair of simultaneous equations gives the steady state vector:

[q1q2]=[0.8330.167]

In conclusion, in the long term about 83.3% of days are sunny. It is important to realize that not all Markov processes have a steady state vector. In particular, the transition matrix must be regular. Otherwise, the state vectors will oscillate over time without converging.

### Stock market

Using a directed graph, the probabilities of the possible states a hypothetical stock market can exhibit is represented. The matrix on the left shows how probabilities corresponding to different states can be arranged in matrix form.

A state diagram for a simple example is shown in the figure on the right, using a directed graph to picture the state transitions. The states represent whether a hypothetical stock market is exhibiting a bull market, bear market, or stagnant market trend during a given week. According to the figure, a bull week is followed by another bull week 90% of the time, a bear week 7.5% of the time, and a stagnant week the other 2.5% of the time. Labeling the state space {1 = bull, 2 = bear, 3 = stagnant} the transition matrix for this example is

P=[0.90.0750.0250.150.80.050.250.250.5].

The distribution over states can be written as a stochastic row vector x with the relation x(n + 1) = x(n)P. So if at time n the system is in state x(n), then three time periods later, at time n + 3 the distribution is

x(n+3)=x(n+2)P=(x(n+1)P)P=x(n+1)P2=(x(n)P)P2=x(n)P3
Markov Chains prediction on 3 discrete steps based on the transition matrix from the example to the left.[8]

In particular, if at time n the system is in state 2 (bear), then at time n + 3 the distribution is

x(n+3)=[010][0.90.0750.0250.150.80.050.250.250.5]3=[010][0.77450.178750.046750.35750.568250.074250.46750.371250.16125]=[0.35750.568250.07425].
Markov chains prediction on 50 discrete steps. Again, the transition matrix from the left is used.[8]

Using the transition matrix it is possible to calculate, for example, the long-term fraction of weeks during which the market is stagnant, or the average number of weeks it will take to go from a stagnant to a bull market. Using the transition probabilities, the steady-state probabilities indicate that 62.5% of weeks will be in a bull market, 31.25% of weeks will be in a bear market and 6.25% of weeks will be stagnant, since:

limN->∞PN=[0.6250.31250.06250.6250.31250.06250.6250.31250.0625]

A thorough development and many examples can be found in the on-line monograph Meyn & Tweedie 2005.[9]

A finite-state machine can be used as a representation of a Markov chain. Assuming a sequence of independent and identically distributed input signals (for example, symbols from a binary alphabet chosen by coin tosses), if the machine is in state y at time n, then the probability that it moves to state x at time n + 1 depends only on the current state.

## Continuous-time

### A birth–death process

See also: Birth–death process and Poisson point process

If one pops one hundred kernels of popcorn in an oven, each kernel popping at an independent exponentially-distributed time, then this would be a continuous-time Markov process. If

denotes the number of kernels which have popped up to time t, the problem can be defined as finding the number of kernels that will pop in some later time. The only thing one needs to know is the number of kernels that have popped prior to the time "t". It is not necessary to know when they popped, so knowing

for previous times "t" is not relevant.

The process described here is an approximation of a Poisson point process – Poisson processes are also Markov processes.

## See also

* Mark V. Shaney
* Interacting particle system
* Stochastic cellular automata

## References

1. ↑ Øksendal, B. K. (Bernt Karsten), 1945- (2003). Stochastic differential equations : an introduction with applications (6th ed.). Berlin: Springer. ISBN 3540047581. OCLC 52203046.
2. ↑ Gagniuc, Paul A. (2017). Markov Chains: From Theory to Implementation and Experimentation. USA, NJ: John Wiley & Sons. pp. 1–235. ISBN 978-1-119-38755-8.
3. ↑ Markov, A. A. "An example of statistical analysis of the text of eugene onegin illustrating the association of trials into a Chain." Bulletin de lAcadamie Imperiale des Sciences de St. Petersburg, ser 6 (1913): 153162.
4. ↑ Grinstead and Snell’s Introduction to Probability, page 465
5. ↑ 5.0 5.1 5.2 Van Kampen, N.G. (2007). Stochastic Processes in Physics and Chemistry. NL: North Holland Elsevier. pp. 73–95. ISBN 978-0-444-52965-7. https://archive.org/details/stochasticproces00kamp_024.
6. ↑ 6.0 6.1 6.2 6.3 Van Kampen, N.G. (2007). Stochastic Processes in Physics and Chemistry. NL: North Holland Elsevier. pp. 73–95. ISBN 978-0-444-52965-7. https://archive.org/details/stochasticproces00kamp_024.
7. ↑ "Going steady (state) with Markov processes". Bloomington Tutors. https://bloomingtontutors.com/blog/going-steady-state-with-markov-processes.
8. ↑ 8.0 8.1 Gagniuc, Paul A. (2017). Markov chains: from theory to implementation and experimentation. Hoboken, NJ: John Wiley & Sons. pp. 131–163. ISBN 9781119387572. OCLC 982373850.
9. ↑ S. P. Meyn and R.L. Tweedie, 2005. Markov Chains and Stochastic Stability

## External links

* Monopoly as a Markov chain

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Examples of Markov chains. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Examples_of_Markov_chains&oldid=228885"