title: using R to estimate finite mixture model with underlying Markov process
body: <p>My apologies if this is more of a statistics question than an R question. I am trying to estimate the following model in R.</p>
  
  <p>y_t = mu0 (1 - S_t) + mu1 S_t + e_t    e_t ~ N(0, sigma_t^2)
  sigma_t^2 = sigma_0^2 (1 - S_t) + sigma_1^2 S_t</p>
  
  <p>where mu_t = mu0 if S_t = 0, mu_t = mu1 if S_t = 1, and S_t is a Markov process, either 0 or 1, with transition probabilities P(S_t = 1 | S_t-1 = 1 ) = p and P(S_t = 0 | S_t-1 = 0 ) = q.</p>
  
  <p>Would 'flexmix' be a good library to use for this? I am new to this kind of statistics so any pointer to the right library would be appreciated.</p>
  
  <p>Thanks,</p>