1
$\begingroup$

I am using the depmixS4 package to fit HMMs to RNAseq count data.
My workflow is as follows:
Stack reads into a 'stack' vector which looks like this:

stack 
[1]  3  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  4  4  4  4  4  4  4  4  4  
[26]  4  4  4  4  4  4  4  4  4  4  4  4  6  6  6  6  7  7  7  8  8  8 10 13 13  
[51] 13 13 13 13 13 16 16 16 16 16 16 14 14 14 14 14 14 14 14 14 15 15 15 16 16  
[76] 16 16 17 17 18 18 18 18 18 18 18 18 18 18 21 22 23 23 23 23 23 23 23 23 23  

To accompany this, for the same length vector (i.e. same chromosomal region) I have the known (manually assigned) state of the signal for a 2 state model i.e.:

RealState  
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  
[38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  
[75] 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

It was my understanding that you could use the depmix() function with the real state vector to fit the model you like e.g.

MODEL <- depmix(stack~1, data = data.frame(stack), nstates=2,family=poisson(), transition = ~ RealState)  
fitted.mod.depmix <- fit(MODEL)
hmmtrack <- posterior(fitted.mod.depmix)$state

However, this does not give me any diffence from running the arbitrarily defined function without providing the RealState despite the fact that this explicitly states there are regions where signal is predicted from the original model that is false.

What is the proper way to provide known states to make a model better suited to my data?

Thanks.

EDIT:

I want to use RealState to initialize the model, and then estimate the parameters of a hidden Markov model (with unknown states).

$\endgroup$
1
$\begingroup$

What you are doing in your code at the moment is modeling transition probabilities as a function of RealState. If you have known states, and you want to treat this as given, you don't really need to use depmixS4 or other software for hidden Markov models. You could for instance run separate GLMs for the subset of data assigned to state 1, and the subset of data assigned to state 2. If you're states are known, the posterior probability of the states should really be 1, as there is no uncertainty.

If you want to use the RealState to initialize the model, and then estimate the parameters of a hidden Markov model (with unknown states), that is possible, that that is a different question.

$\endgroup$
  • $\begingroup$ Thanks for the explanation, I do indeed want to use RealState to initislise a model to be applied to sets of unknown state. Could you point me in the right direction? $\endgroup$ – DOOP Jun 20 '18 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.