I am using the depmixS4 package to fit HMMs.

I have three different classes of data and I have fitted 3 separate HMMs using the depmixS4 depmix and fit functions and given a new sequence of observations, I would like to be able to compute the probability (or log odds) of that new observation sequence given each of the three models that have already been trained.

I understand this would normally be done using the Viterbi algorithm, but I have no idea how this can be implemented in depmixS4.

Due to the functionality of depmixS4 I cannot use the HMM or HiddenMarkov packages

Your help is greatly appreciated!

Thank you in advance

**Contents**hide

#### Best Answer

You must use ** forward** function to calculate the likelihood by sum forward's probability from first step until last one.

`sum(forward_prob(t)) `

### Similar Posts:

- Solved – Question about classification with hidden Markov models using depmixS4
- Solved – Latent class model with both continuous and categorical indicators in R
- Solved – the difference between the forward-backward and Viterbi algorithms
- Solved – Scikit-Learn GaussianHMM decode vs score
- Solved – Hidden Markov Model with MFCC coefficients