title: Method to scale Hidden Markov model graph to overlay data?
body: <p>I've been trying different implementations of HMM algorithms in R but one thing they all have in common is that they will only give absolute states in integers, i.e. 1, 2, 3...</p>
  
  <p>There's a Matlab implementation of the Viterbi algorithm, called vbFRET that somehow autoscales the found states to the graph.</p>
  
  <p><a href="https://i.stack.imgur.com/JtSM6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JtSM6.png" alt="enter image description here"></a> </p>
  
  <hr>
  
  <p>I've plotted data from both in R. Red line is the method used by the software vbFRET as above (I have some exported data, I didn't re-implement the method myself). Blue is my own fitting with the depmixS4 package in R, and scaled between 0 and 1.</p>
  
  <p><a href="https://i.stack.imgur.com/ECSP3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ECSP3.png" alt="enter image description here"></a></p>
  
  <p>How would I make a generalizable method to autoscale the integer states to the actual graph values?</p>
  
  <p>Minimal example:
  <a href="https://pastebin.com/78tqWc3Q" rel="nofollow noreferrer">https://pastebin.com/78tqWc3Q</a></p>
  
  <p>Code included, again, so the website won't be upset with me.</p>
  
  <pre><code>plot(E, type = "l")
  lines(Single_Trace_state, lwd = 3, col = "blue")
  </code></pre>