How can I identify market regimes with a Hidden Markov Model?

I am trying to identify market regimes (2 states: bull or bear) with percent changes in equity returns. Can you help me in the mathematicl modeling of this? So far, I thought that for each day, there is a state $x_i$ (either bull or bear), and an observed value, $y_i$, that is the percent change in the daily equity returns. Currently for my model, I have that $x_i$ affects $x_{i+1}$ through the following $x_{i+1} \sim bernoulli(\phi * x_i)$, where $\phi \sim Uniform(0,1)$ is the probability of a bull market. However, I am not sure how to represent the relationship between $y_i$ and $x_i$. Should it be some kind of inverse logistic relation, since $x_i$ is binary $y_i$ is a continuous value? Please let me know if any of my model is wrong and any suggestions (maybe I should model it as probability of bear or bull market? Sorry, I am new to hidden Markov models).

• There is no reason to have a functional relationship between the random variables $X_i$ and $Y_i$. You can have the parameters of $p(y_i|x_i)$ depend on $x_i$ however you'd like – Taylor Dec 4 '16 at 19:08