Random Number Generation - Handout #14
Let's revisit Kobayashi, Chapter 2.
Example 1
Let's look the following:
|
1/6 |
0 |
1/6 |
0 |
2/3 |
||
|
0 |
1/4 |
0 |
0 |
3/4 |
||
|
Q = |
1/4 |
3/8 |
1/8 |
1/4 |
0 |
|
|
0 |
0 |
0 |
1 |
0 |
||
|
0 |
1/3 |
0 |
0 |
2/3 |
The rows . The columns , so .
Which states are unstable? .
Which states are closed? .
: Once in these states, can't get out of them; can go back and forth between 2 and 5, but not to the other states.
: Absorbing state.
These sets then are . There are two .
Since this Q has , it is .
Ergodic: for a Markov chain to be ergodic, it must be irreducible and aperiodic and all states must be positive-recurrent. Therefore, this Q is not ergodic because it is reducible!
Example 2 - this is Example 2.9.4.
|
2/3 |
1/3 |
0 |
|
|
Q = |
1/2 |
0 |
1/2 |
|
0 |
0 |
1 |
Stochastic?
Doubly Stochastic?
Absorbing state(s)?
Transient state(s)?
Irreducible? .
|
i |
j |
qij |
fij(1) |
fij(2) |
fij(3) |
|
1 |
1 |
2/3 |
|||
|
1 |
2 |
1/3 |
|||
|
1 |
3 |
0 |
|||
|
2 |
1 |
1/2 |
|||
|
2 |
2 |
0 |
|||
|
2 |
3 |
1/2 |
|||
|
3 |
1 |
0 |
|||
|
3 |
2 |
0 |
|||
|
3 |
3 |
1 |
Remember, fij(n) is the probability that starting i, at time zero, the system is in state j for the first time at time n.
Can we get a stationary distribution (p ) for this Q?
Example 3
|
0 |
1 |
0 |
|
|
Q = |
1/4 |
1/4 |
1/2 |
|
0 |
1/2 |
1/2 |
Stochastic?
Doubly Stochastic?
Absorbing state(s)?
Transient state(s)?
Recurrent state(s)?
Irreducible?
Aperiodic?
Ergodic?
|
i |
j |
qij |
fij(1) |
fij(2) |
fij(3) |
fij(4) |
|
1 |
1 |
0 |
||||
|
1 |
2 |
1 |
||||
|
1 |
3 |
0 |
||||
|
2 |
1 |
1/4 |
||||
|
2 |
2 |
1/4 |
||||
|
2 |
3 |
1/2 |
||||
|
3 |
1 |
0 |
||||
|
3 |
2 |
1/2 |
||||
|
3 |
3 |
1/2 |
What do we notice about fii?
fii = å fii(n), for n = 1 to infinity.
If fii = 1, then state i is called a recurrent state, and if fii < 1, it is called a transient state.
We see for f11 = 1/4 + 1/16 + 5/64 + … > 1/4 + 1/16 + 1/64 + …
Does this sum to one?
If we rewrite this as:
f11 > 1/4 + (1/4)(1/4) + (1/4)(1/4)2 + …
then we can assume that the next term is [1/4](1/4)3; we are multiplying the previous term by 1/4. This sequence is an infinite geometric series (from Algebra 2 or Trigonometry) and it approaches a limit, or converges to a limit, so it is also called a convergent series.
The sum of an infinite convergent series is:
In our series above, a1 is the first term, 1/4, and r is 1/4. So the sequence is a1, a1r, a1r2, …
So,
S = a1/(1 - r) = (1/4)/(1-1/4) = (1/4)/(3/4) = (1/4)*(4/3) = 1/3.
With the information that we have, we see that state 1 is a transient state. Note that f21 has the same numbers.
What about states 2 and 3? Are they transient or recurrent?
We see:
f22 = 1/4 + 1/2 + 1/8 + 1/16 + ….
Rewrite this as:
f22 = 1/2 + [(1/4) + (1/4)(1/2) + (1/4)(1/2)2 + ….]
Note that the terms after the "1/2 +" constitute another infinite convergent series. The sum is:
S = a1/(1 - r) = (1/4)/(1-1/2) = (1/4)/(1/2) = (1/4)*(2/1) = 1/2.
Then we add this to the 1/2 we left out:
f22 = .
So we see that state 2 is .
What about state 3?
We see:
f33 = 1/2 + 1/4 + 1/16 + 1/16 + ….
Note that as n gets larger from this point, i.e., n = 5, n = 6, etc., we will be multiplying the previous term by the self-loop on state 2, which is 1/4. So, this last 1/16 will be the starting term for the infinite convergence series.
f33 = 1/2 + 1/4 + 1/16 + [(1/16) + (1/16)(1/4) + (1/16)(1/4)2 + ….]
f33 = 13/16 + [(1/16) + (1/16)(1/4) + (1/16)(1/4)2 + ….]
Note that the terms after the "13/16 +" constitute another infinite convergent series. The sum is:
S = a1/(1 - r) = (1/16)/(1-1/4) = (1/16)/(3/4) = (1/16)*(4/3) = 1/12.
Then we add this to the 13/16 we left out:
f33 = 13/16 + 1/12 = 156/192 + 16/192 = .
So we see that state 3 is .
Is state 2 a null-recurrent or positive-recurrent state?
A recurrent state i is null-recurrent if the expected recurrence time m ii is infinite, and positive-recurrent if m ii < ¥ .
For state 2, we know f22 = 1, so we can use Kobayashi equation 2.246 on page 88.
m ii = qii + å k¹ j qik (m ki + 1)
So,
m 22 = q22 + å k¹ j q2k (m k2 + 1)
m 22 = 1/4 + {q21 (m 12 + 1)} + {q23 (m 32 + 1)}
m 22 = 1/4 + (1/4) (m 12 + 1) + (1/2) (m 32 + 1)
Well then, what about the other fij? Don't we need to know these too? Two of them, m 12 and m 32!
We know right off the bat that:
f12 = 1
because q12 = 1. So, we know that m 12 is less than infinity.
Let's use the equation.
m 12 = q12 + å k¹ j q1k (m k2 + 1)
m 12 = 1 + {q11 (m 12 + 1)} + {q13 (m 32 + 1)}
m 12 = 1 + {0 (m 12 + 1)} + {0 (m 32 + 1)} = 1
What about f32?
f32 = 1/2 + 1/4 + 1/8 + 1/16 + … = 1/2 + (1/2)(1/2) + (1/2)(1/2)2 = 1
Because S = (1/2)/(1 - 1/2) = 1. Therefore, m 32 is less than infinity too.
m 32 = q32 + å k¹ j q3k (m k2 + 1)
m 32 = 1/2 + {q31 (m 12 + 1)} + {q33 (m 32 + 1)}
m 32 = 1/2 + {0 (m 12 + 1)} + {1/2 (m 32 + 1)}
m 32 = 1/2 + 1/2 (m 32 + 1)
m 32 = 1/2 + (1/2)m 32 + 1/2
m 32 = 1 + (1/2)m 32
(1/2)m 32 = 1
m 32 = 2
Substituting the results back into the equation above:
m 22 = 1/4 + (1/4) (m 12 + 1) + (1/2) (m 32 + 1)
m 22 = 1/4 + (1/4) (1 + 1) + (1/2) (2 + 1) = (1/4) + (1/2) + (3/2) = 9/4
So, m 22 < ¥ , so state 2 is a . (A is also called a regular-recurrent state.)
Example 4 - from Example 2.9.5.
|
0 |
1 |
0 |
0 |
|
|
Q = |
1/2 |
0 |
1/2 |
0 |
|
0 |
1/2 |
0 |
1/2 |
|
|
0 |
0 |
1 |
0 |
Stochastic? .
Doubly stochastic? .
Periodic? Yes. The number of transitions to return to state 1, for example, is 2, 4, 6, 8, …
So, it is periodic with period
|
i |
j |
qij |
fij(1) |
fij(2) |
fij(3) |
fij(4) |
fij(5) |
fij(6) |
|
1 |
1 |
0 |
||||||
|
1 |
2 |
1 |
||||||
|
1 |
3 |
0 |
||||||
|
1 |
4 |
0 |
||||||
|
2 |
1 |
1/2 |
||||||
|
2 |
2 |
0 |
||||||
|
2 |
3 |
1/2 |
||||||
|
2 |
4 |
0 |
||||||
|
3 |
1 |
0 |
||||||
|
3 |
2 |
1/2 |
||||||
|
3 |
3 |
0 |
||||||
|
3 |
4 |
1/2 |
||||||
|
4 |
1 |
0 |
||||||
|
4 |
2 |
0 |
||||||
|
4 |
3 |
1 |
||||||
|
4 |
4 |
0 |
What do we notice about fii?
fii = å fii(n), for n = 1 to infinity.
If fii = 1, then state i is called a recurrent state, and if fii < 1, it is called a transient state.
We see for f11 = 1/2 + 1/8 + 3/32 + ….
Does this sum to one?
If we rewrite this as:
f11 > 1/2 + 1/(23) + 1/(25) + …., or,
f11 > 1/2 + [1/2](1/4) + [1/2](1/4)2 + ….
then we can assume that the next term is [1/2](1/4)3 or 1/(27); we are multiplying the previous term by 1/22, or 1/4. This sequence is an infinite geometric series, also called a convergent series.
The sum of an infinite convergent series is:
S = a1/(1 - r), | r | < 1.
In our series above, a1 is the first term, 1/2, and r is 1/4. So the sequence is a1, a1r, a1r2, …
So,
S = a1/(1 - r) = (1/2)/(1-1/4) = (1/2)/(3/4) = (1/2)*(4/3) = 2/3.
With the information that we have, we see that state 1 is a . Note that state 4 has the same numbers, so it too is a .
What about states 2 and 3? Are they transient or recurrent?
We see:
f22 = f33 = 3/4 + 1/8 + 1/16 + ….
Rewrite this as:
f22 = f33 = 1/2 + 1/4 + [1/4][(1/2) + [1/4](1/2)2 + ….
Note that the terms after the "1/2 +" constitute another infinite convergent series. The sum is:
S = a1/(1 - r) = (1/4)/(1-1/2) = (1/4)/(1/2) = (1/4)*(2/1) = 1/2.
Then we add this to the 1/2 we left out:
f22 = f33 = 1/2 + 1/2 = 1.
So we see that states 2 and 3 are .
Are they null-recurrent or positive-recurrent states?
A recurrent state i is null-recurrent if the expected recurrence time m ii is infinite, and positive-recurrent if m ii < ¥ .
For states 2 and 3, we know f22 = f33 = 1, so we can use Kobayashi equation 2.246 on page 88.
m ii = qii + å k¹ j qik (m ki + 1)
So,
m 22 = q22 + å k¹ j q2k (m k2 + 1)
m 22 = 0 + {q21 (m 12 + 1)} + {q23 (m 32 + 1)} + {q24 (m 42 + 1)}
m 22 = (1/2) (m 12 + 1) + (1/2) (m 32 + 1) + 0 (m 42 + 1)
m 22 = (1/2) {(m 12 + 1) + (m 32 + 1)}
m 22 = (1/2) {m 12 + m 32 + 2}
Well then, what about the other fij? Don't we need to know these too? Some of them!
We know right off the bat that:
f12 = f43 = 1
because q12 and q43 = 1. So, we know that m 12 and m 43 are less than infinity.
f13 = f23 = f32 = f42 = 1/2 + 1/4 + 1/8 + … = 1/2 + (1/2)(1/2) + (1/2)(1/2)2 = 1
Because S = (1/2)/(1 - 1/2) = 1. Therefore, m 13, m 23, m 32 and m 42 are less than infinity too.
m 12 = q12 + å k¹ j q1k (m k2 + 1)
m 12 = 1 + {q11 (m 12 + 1)} + {q13 (m 32 + 1)} + {(q14 (m 42 + 1)}
m 12 = 1 + {0 (m 12 + 1)} + {0 (m 32 + 1)} + {(0 (m 42 + 1)} = 1
m 32 = q32 + å k¹ j q3k (m k2 + 1)
m 32 = 1/2 + {q31 (m 12 + 1)} + {q33 (m 32 + 1)} + {q34 (m 42 + 1)}
m 32 = 1/2 + {0 (m 12 + 1)} + {0 (m 32 + 1)} + {(1/2) (m 42 + 1)} = 1/2 + {(1/2) (m 42 + 1)}
m 32 = 1 + (1/2) m 42
We know f42 = 1,
m 42 = q42 + å k¹ j q4k (m k2 + 1)
m 42 = 1 + {q41 (m 12 + 1)} + {q43 (m 32 + 1)} + {(q44 (m 42 + 1)}
m 42 = 1 + {0 (m 12 + 1)} + {1 (m 32 + 1)} + {0 (m 42 + 1)}
m 42 = 2 + m 32
We can solve these last two equations:
m 32 = 1 + (1/2) (2 + m 32)
m 32 = 2 + (1/2) (m 32)
(1/2)m 32 = 2
m 32 = 4
Substituting the results back into the equation above:
m 22 = (1/2) {m 12 + m 32 + 2}
m 22 = (1/2) {1 + 4 + 2} = (1/2){7} = 7/2.
So, m 22 < ¥ , so state 2 is a .
What about state 3?
m ii = qii + å k¹ j qik (m ki + 1)
So,
m 33 = q33 + å k¹ j q3k (m k3 + 1)
m 33 = 0 + {q31 (m 13 + 1)} + {q32 (m 23 + 1)} + {q34 (m 43 + 1)}
m 33 = 0 (m 13 + 1) + (1/2)(m 23 + 1) + (1/2) (m 43 + 1)
m 33 = (1/2)(m 23 + 1) + (1/2) (m 43 + 1)
We know from above that f23 = 1, so m 23 < ¥ . So we can use the equation:
m 23 = q23 + å k¹ j q2k (m k3 + 1)
m 23 = 1/2 + {q21 (m 13 + 1)} + {q22 (m 23 + 1)} + {q24 (m 43 + 1)}
m 23 = 1/2 + {(1/2) (m 13 + 1)} + {0 (m 23 + 1)} + {0 (m 43 + 1)}
m 23 = 3/2 + (1/2) m 13
We know from above that f13 = 1, so m 13 < ¥ . So we can use the equation:
m 13 = q13 + å k¹ j q1k (m k3 + 1)
m 13 = 0 + {q11 (m 13 + 1)} + {q12 (m 23 + 1)} + {q14 (m 43 + 1)}
m 13 = 0 (m 13 + 1) + 1 (m 23 + 1) + 0 (m 14 + 1)
m 13 = m 23 + 1
Using these two equations, we can solve for both.
m 13 = m 23 + 1
m 13 = 3/2 + (1/2) m 13 + 1
(1/2)m 13 = 5/2
m 13 = 10/2 = 5
m 23 = 4
We know from above that f43 = 1, so m 43 < ¥ . So we can use the equation:
m 43 = q43 + å k¹ j q4k (m k3 + 1)
m 43 = 1 + {q41 (m 13 + 1)} + {q42 (m 23 + 1)} + {q44 (m 43 + 1)}
m 43 = 1 + 0 (m 13 + 1) + 0 (m 23 + 1) + 0 (m 14 + 1)
m 43 = 1
Using these results, we can substitute it in the equation above:
m 33 = (1/2)(m 23 + 1) + (1/2) (m 43 + 1)
m 33 = (1/2)(4 + 1) + (1/2) (1 + 1) = (5/2) + 1 = 7/2.
So, state 3 is also .
Theorem 2.9.1, page 89. In an irreducible Markov chain, all states belong to the same class: either they are all transient, all null-recurrent, or all positive-recurrent states.
Theorem 2.9.2, page 89. An irreducible Markov chain has at most one stationary distribution (p ) and one of the following:
Note that p j = 1/m ii, for i = 1, 2, …, N. (Formula 2.251, page 89)
Example 5 - Look at example 3 above again:
|
0 |
1 |
0 |
|
|
Q = |
1/4 |
1/4 |
1/2 |
|
0 |
1/2 |
1/2 |
Finding the stationary distribution:
p 1 = 0× p 1 + (1/4)× p 2 + 0× p 3 = (1/4)× p 2, or p 2 = 4× p 1
p 2 = 1× p 1 + (1/4)× p 2 + (1/2)× p 3
p 3 = 0× p 1 + (1/2)× p 2 + (1/2)× p 3 = (1/2)× p 2 + (1/2)× p 3
p 3 = (1/2)× p 2 + (1/2)× p 3 = (1/2)× 4× p 1 + (1/2)× p 3
(1/2)× p 3 = 2× p 1
p 3 = 4× p 1
1 = p 1 + p 2 + p 3 = p 1 + 4× p 1 + 4× p 1 = 9× p 1, or p 1 = 1/9
p 2 = p 3 = 4× p 1 = 4× (1/9) = 4/9
p = [ ]
In the work above, we found that m 22 = 9/4. Using the formula 2.251,
p 2 = 1/m 22 = 1/(9/4) = 4/9.
Note that this matches what we found above!
If we worked through the other states too we would get the appropriate answers! So, even though a given state may be transient, if it belongs to an irreducible aperiodic Markov chain all states are the same - if there's a unique stationary distribution then we know they are all ergodic!
Example 6 - revisit example 4.
|
0 |
1 |
0 |
0 |
|
|
Q = |
1/2 |
0 |
1/2 |
0 |
|
0 |
1/2 |
0 |
1/2 |
|
|
0 |
0 |
1 |
0 |
p 1 = 0× p 1 + (1/2)× p 2 + 0× p 3 + 0× p 4 = (1/2)× p 2
p 2 = 1× p 1 + 0× p 2 + (1/2)× p 3 + 0× p 4 = 1× p 1 + (1/2)× p 3
p 3 = 0× p 1 + (1/2)× p 2 + 0× p 3 + 1× p 4 = (1/2)× p 2 + 1× p 4
p 4 = 0× p 1 + 0× p 2 + (1/2)× p 3 + 0× p 4 = (1/2)× p 3
p 3 = (1/2)× p 2 + 1× p 4 = (1/2)× p 2 + 1× (1/2)× p 3
(1/2)× p 3 = (1/2)× p 2
p 3 = p 2
p 4 = (1/2)× p 2
1 = p 1 + p 2 + p 3 = (1/2)× p 2 + p 2 + p 2 + (1/2)× p 2 = 3× p 2, or p 2 = 1/3
p 2 = p 3 = 1/3
p 1 = (1/2)× p 2 = (1/2)(1/3) = 1/6
p 4 = (1/2)× (1/3) = 1/6
p = [ ]
Why don't they match up to what we had before?