__Question:__
1. Mr. X is happy
someday and angry on other days. We can only observe when he smiles, frowns,
laughs, or yells but not his actual emotional state. Let us start on day 1 in
the happy state. There can be only one state transition per day. It can be
either to happy state or angry state. The HMM is shown below;

Assume that q

_{t}is the state on day t and o_{t}is the observation on day t. Answer the following questions;
(a) What is

*P(q*?_{2}= Happy)
(b) What is

*P(o*?_{2}= frown)
(c) What is

*P(q*?_{2}= Happy | o_{2}= frown)
(d) What is

*P(o*if_{1}= frown o_{2}= frown o_{3}= frown o_{4}= frown o_{5}= frown, q_{1}= Happy q_{2}= Angry q_{3}= Angry q_{4}= Angry q_{5}= Angry)*π**= [0.7, 0.3]*?

__Solution:__**(a) What is**

*P(q*?_{2}= Happy)
The question is to
find the probability of Mr. X is

**on day 2. It is given that the first day he was***Happy***. For the second day, we need to find the transition probability***Happy**P(q*|_{2}= Happy*q*_{1}= Happy).*P(q*|

_{2}= Happy*q*

_{1}= Happy) = 0.8**(b) What is**

*P(o*?_{2}= frown)
We need to find the
probability of observation

**on day 2. But we don’t know the states whether he is happy or not on day 2 (we know he was happy on day 1). Hence, the probability of the observation is the sum of products of observation probabilities and all possible hidden state transitions.***frown*

*P(o*_{2}= frown) = P(o_{2}= frown | q_{2}= Happy) + P(o_{2}= frown | q_{2}= Angry)

*= P(Happy | Happy)* P(frown | Happy) + P(Angry | Happy)* P(frown | Angry)*

*= (0.8 * 0.1) + (0.2 * 0.5) = 0.08 + 0.1 = 0.18***(c) What is**

*P(q*?_{2}= Happy | o_{2}= frown)
Here, we need to
find the probability of hidden state on day 2 as Happy given the observation on
that day as frown. This conditional probability cannot be calculated directly. Hence,
we apply Bayes’ rule to solve as follows;

*P(q*_{2}= Happy | o_{2}= frown) = (P(o_{2}= f| q_{2}= H) * P(q_{2}= H)) / P(o_{2}= f)

*= (P(Happy | Happy)* P(frown | Happy)) / 0.18*

*[Note: 0.18 is taken from the answer for question (b)]*

*= (0.8 * 0.1) / 0.18 = 0.08 / 0.18 = 0.4444***(d) What is**

*P(o*if_{1}= frown o_{2}= frown o_{3}= frown o_{4}= frown o_{5}= frown, q_{1}= Happy q_{2}= Angry q_{3}= Angry q_{4}= Angry q_{5}= Angry)*π = [0.7, 0.3]*?
Here, we need to
find the probability of the observation sequence “

*frown frown frown frown frown*” given the state sequence “*Happy Angry Angry Angry Angry*”. π*is the initial probabilities.*

*P(f f f f f, H A A A A)*

*= P(f|H)*P(f|A)*P(f|A)*P(f|A)*P(f|A)*P(H)*P(A|H)*P(A|H)*P(A|H)*P(A|H)*

*= 0.1 * 0.5 * 0.5 * 0.5 * 0.5 * 0.7 * 0.2 * 0.2 * 0.2 * 0.2*

*= 0.000007*******************

###
**Related Links:**

**Related Links:**

- Go to Hidden Markov Model Formal Definition page