Examples of Markov Chains

Example of a Markov Chain about Weather

  • Suppose that weather on any given day can be classified in two states: sunny and rainy
  • Let's first define the following variables:
St+1=Tomorrow is sunny{0,1}S_{t+1} = \text{Tomorrow is sunny} \in \lbrace 0,1 \rbrace Rt+1=Tomorrow is rainy{0,1}R_{t+1} = \text{Tomorrow is rainy} \in \lbrace 0,1 \rbrace St=Today is sunny{0,1}S_{t} = \text{Today is sunny} \in \lbrace 0,1 \rbrace Rt=Today is rainy{0,1}R_{t} = \text{Today is rainy} \in \lbrace 0,1 \rbrace
  • Based on our previous experiences, we know the following:
P(St+1St)=0.9P(S_{t+1}|S_{t}) = 0.9 P(Rt+1St)=0.1P(R_{t+1}|S_{t}) = 0.1 P(St+1Rt)=0.5P(S_{t+1}|R_{t}) = 0.5 P(Rt+1Rt)=0.5P(R_{t+1}|R_{t}) = 0.5
  • Therefore, a Markov Chain with a State Space S={Sunny,Rainy}S= \lbrace Sunny, Rainy \rbrace has the following transition matrix:
P=[St+1Rt+1St.9.1Rt0.50.5]P = \begin{bmatrix} & S_{t+1} & R_{t+1} \cr S_{t} & .9 & .1 \cr R_{t} & 0.5 & 0.5 \end{bmatrix}
  • Now, let's say we wanted to calculate the probability of the weather being sunny two days from today, and we know that the weather today is sunny
  • Then, we would need to calculate the following conditional probabilities:
P(St+1St,St+1St)=0.9×0.9=0.81P(S_{t+1}|S_{t}, S_{t+1}|S_{t}) = 0.9 \times 0.9 = 0.81 P(Rt+1St,St+1Rt)=0.1×0.5=0.05P(R_{t+1}|S_{t}, S_{t+1}|R_{t}) = 0.1 \times 0.5 = 0.05 P(St+1St,St+1St)+P(Rt+1St,St+1Rt)=0.81+0.05=0.86P(S_{t+1}|S_{t}, S_{t+1}|S_{t}) + P(R_{t+1}|S_{t}, S_{t+1}|R_{t}) = 0.81 + 0.05 = 0.86
  • Here, P(St+1St,St+1St)P(S_{t+1}|S_{t}, S_{t+1}|S_{t}) refers to the probability of going from sunny weather on the 1st1^{st} day to sunny weather on the 2nd2^{nd} day to sunny weather on the 3rd3^{rd} day
  • And, P(Rt+1St,St+1Rt)P(R_{t+1}|S_{t}, S_{t+1}|R_{t}) refers to the probability of going from sunny weather on the 1st1^{st} day to rainy weather on the 2nd2^{nd} day to sunny weather on the 3rd3^{rd} day
  • Then, the sum of these two conditional probabilities will give us the probability of the weather being sunny two days from now
  • We could also handle the above situation as the following:

    1. Let an event A={SS,SR,RS,RR}A= \lbrace SS,SR,RS,RR \rbrace represent a set of possible weather transitions from one day to another

      • Where SS=SS = a day of sunny weather where the previous day was also sunny
      • Where SR=SR = a day of rainy weather where the previous day was sunny
      • Where RS=RS = a day of sunny weather where the previous day was rainy
      • Where RR=RR = a day of rainy weather where the previous day was also rainy
    2. Calculate the following probability:
    P(SS,SS)P(SS,SS)
    1. Calculate the following probability:
    P(SR,RS)P(SR,RS)
    1. Calculate the following probability:
    P(Second day is sunny)=P(SS,SS)+P(SR,RS)P(\text{Second day is sunny}) = P(SS,SS) + P(SR,RS)

References

Previous
Next

Markov Chains

Hidden Markov Chains