= c("vowel", "consonant")
state_names
= rbind(
P c(0.128, 0.872),
c(0.663, 0.337)
)
= c(0.432, 0.568) pi_0
Steady State Distributions
Markov’s letters
1-step transition matrix
plot_transition_matrix(P, state_names)
2-step transition matrix
plot_transition_matrix(P, state_names, n_step = 2)
3-step transition matrix
plot_transition_matrix(P, state_names, n_step = 3)
5-step transition matrix
plot_transition_matrix(P, state_names, n_step = 5)
10-step transition matrix
plot_transition_matrix(P, state_names, n_step = 10)
20-step transition matrix
plot_transition_matrix(P, state_names, n_step = 20)
Ehrenfest urn chain
= 3
M
= 0:M
state_names
= rbind(c(0, 1, 0, 0),
P c(1/3, 0, 2/3, 0),
c(0, 2/3, 0, 1/3),
c(0, 0, 1, 0)
)
100-step transition matrix
plot_transition_matrix(P, state_names, n_step = 100)
101-step transition matrix
plot_transition_matrix(P, state_names, n_step = 101)
Stationary distribution
= compute_stationary_distribution(P)
pi_s
# display in table
data.frame(state_names, t(pi_s)) |>
kbl(col.names = c("state", "stationary probability")) |>
kable_styling()
state | stationary probability |
---|---|
0 | 0.125 |
1 | 0.375 |
2 | 0.375 |
3 | 0.125 |
Ping pong
= c("AB", "AC", "BC")
state_names
= rbind(c(0, .7, .3),
P c(.8, 0, .2),
c(.6, .4, 0)
)
Stationry distribution
= compute_stationary_distribution(P)
pi_s
# display in table
data.frame(state_names, t(pi_s)) |>
kbl(col.names = c("state", "stationary probability"), digits = 4) |>
kable_styling()
state | stationary probability |
---|---|
AB | 0.4220 |
AC | 0.3761 |
BC | 0.2018 |
transition matrix
plot_transition_matrix(P, state_names, n_step = 1)
2-step transition matrix
plot_transition_matrix(P, state_names, n_step = 2)
10-step transition matrix
plot_transition_matrix(P, state_names, n_step = 10)
20-step transition matrix
plot_transition_matrix(P, state_names, n_step = 20)