title: Getting the next observation from a HMM gaussian mixture distribution
body: <p>I have a continuous univariate xts object of length 1000, which I have converted into a data.frame called x to be used by the package <code>RHmm</code>.</p>
  
  <p>I have already chosen that there are going to be 5 states and 4 gaussian distributions in the mixed distribution.</p>
  
  <p><strong>What I'm after is the expected mean value for the next observation. How do I go about getting that?</strong></p>
  
  <p>So what I have so far is:</p>
  
  <ol>
  <li>a transition matrix from running the <code>HMMFit()</code> function</li>
  <li>a set of means and variances for each of the gaussian distributions in the mixture, along with their respective proportions, all of which was also generated form the <code>HMMFit()</code> function</li>
  <li>a list of past hidden states relating to the input data when using the output of the HMMFit function and putting it into the <code>viterbi</code> function</li>
  </ol>
  
  <p>How would I go about getting the next hidden state (i.e. the 1001st value) from what I've got, and then using it to get the weighted mean from the gaussian distributions.</p>
  
  <p>I think I'm pretty close just not too sure what the next part is...The last state is state 5, do I use the 5th row in the transition matrix somehow to get the next state? </p>
  
  <p>All I'm after is the weighted mean for what is to be expect in the next observation, so the next hidden state isn't even necessary. Do I multiply the probabilities in row 5 by each of the means, weighted to their proportion for each state? and then sum it all together? </p>
  
  <p>here is the code I used.</p>
  
  <pre><code># have used 2000 iterations to ensure convergence
  a &lt;- HMMFit(x, nStates=5, nMixt=4, dis="MIXTURE", control=list(iter=2000)
  v &lt;- viterbi(a,x)
  a
  v
  </code></pre>
  
  <p>As always any help would be greatly appreciated!</p>