# Could the transition matrix on wiki be interpreted with “Rainy and Sunny” example?

The forward–backward algorithm is an inference algorithm for hidden Markov models which computes the posterior marginals of all hidden state variables given a sequence of observations/emissions

The transition matrix is

$$\mathbf {T} ={\begin{pmatrix}0.7&0.3\\0.3&0.7\end{pmatrix}}$$

in the context of 'Rainy' and 'Sunny', could the transition matrix be viewed as follow?

$$T_{11} = 0.7, T_{12} = 0.3$$ means the day after a Sunny day has a 70% chance of being Sunny day (staying), and a 30% chance of being Rainy (transitioning),

while $$T_{21} = 0.7, T_{22} = 0.3$$ means the day after a Rainy day has a 30% chance of being Rainy day (staying), and a 70% chance of being Sunny (transitioning).

is my understanding right?

• I don't know lots of the terminology of the first paragraph, but everything after that is correct. – Viktor Glombik Jul 24 '19 at 21:55

When using the vector-matrix multiplication $$\pi_{n+1}= \pi_n\mathbf T$$, then $$\mathbf T_{xy}$$ is the conditional probability of it being $$y$$ on the next day when given that it is $$x$$ the 'current' day; and we are valuing $$x,y$$ as 1 for rainy and 2 for sunny ($$x$$ is the row, $$y$$ the column).
$$\begin{bmatrix}\mathsf P(W_{n+1}{=}r),\mathsf P(W_{n+1}{=}s)\end{bmatrix}=\begin{bmatrix}\mathsf P(W_{n}{=}r),\mathsf P(W_{n}{=}s)\end{bmatrix}~\underbrace{\begin{bmatrix}\mathsf P(W_{n+1}{=}r\mid W_n{=}r)&\mathsf P(W_{n+1}{=}s\mid W_n{=}r)\\\mathsf P(W_{n+1}{=}r\mid W_n{=}s)&\mathsf P(W_{n+1}{=}s\mid W_n{=}s)\end{bmatrix}}_{\bf T}$$
• $$T_{11}$$ is the probability that a rainy day follows a rainy day
• $$T_{12}$$ is the probability that a sunny day follows a rainy day
• $$T_{21}$$ is the probability that a rainy day follows a sunny day
• $$T_{22}$$ is the probability that a sunny day follows a sunny day
• Thanks for your answer. Does this part $\begin{bmatrix}\mathsf P(W_{n}{=}r),\mathsf P(W_{n}{=}s)\end{bmatrix}$ represent the initial state $\pi$? – czlsws Jul 25 '19 at 2:14
• Yes. The vector $\pi_n$ contains the probabilities that the weather on day $n$ has the indicated value (rainy or sunny, respectively). – Graham Kemp Jul 25 '19 at 3:38