How do I calculate conditional probabilty with a markov chain?

58 Views Asked by At

Currently I am learning about markov chains. I am struggeling with a problem, which is beautifully explained in the first answer of this post:

Forming the transition matrix for Markov chain, given a word description of transition probabilities.

However, in addition I want to know the following:

Suppose that it has rained neither yesterday nor the day before yesterday. What is the probability that it will rain tomorrow?

I made the relevant transitions bold, because the $0.6$ goes from NNY to NYY, and the $0.2$ goes from NNN to NNY.

$$\begin{bmatrix} 0.8 & 0.2 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0.4 & 0.6 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0.6 & 0.4 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0.4 & 0.6 \\ 0.6 & 0.4 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0.4 & 0.6 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \textbf{0.6} & 0.4 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & \textbf{0.2} & 0.8 \\ \end{bmatrix}$$

From the problem statement I understand that I need to find the probability that it will rain tomorrow given that there was no rain yesterday and no rain the day before yesterday.

The struggle is that each probablity is conditioned on the probability of the initial state:

$$ \mathbb{P}\left(X_{n+1}=j \mid X_n=i\right)=\mathbb{P}\left(X_1=j \mid X_0=i\right)=P_{i j} $$

And that is not the condition on which we want the final answer to be conditioned.

Assuming that each state is equally likely with $\mathbb{P} = \frac{1}{8}$, we can find the joint probability $\mathbb{P}\left(X_{n+1}=NNY, X_n=NYY\right)$ by multiplying the transition probability with the probability of the initial state:

$\mathbb{P}\left(X_{n+1}=NYY, X_n=NNY\right) = 0.6 * \frac{1}{8} = \frac{3}{40}$

We also do this for find the other joint probability:

$\mathbb{P}\left(X_{n+1}=NNY, X_n=NNN\right) = 0.2 * \frac{1}{8} = \frac{1}{40}$

If we add these probabilities together, let

$\mathbb{P}\left(A\right)$ = $\frac{4}{40}$ with $A$ the joint event that it will rain tomorrow and that there was no rain yesterday nor rain the day before yesterday.

We know that "there was no rain yesterday nor rain the day before yesterday" makes $\frac{2}{8}$ of the states. If we define that as event $B$ we see that $\mathbb{P}\left(B\right) = \frac{1}{4}$.

If we condition the joint probability $A$ on $B$ we get $\frac{2}{5}$.

Given my knowlegde, this is the most logical outcome I could think of. Does this approach make sense? I am still a student. It would be amazing if I could receive feedback on this.