getViterbi {STAN} | R Documentation

## Calculate the most likely state path

### Description

Given a Hidden Markov Model, the function calculates the most likely state path (viterbi) for one or more observation sequence.

### Usage

    getViterbi(hmm, obs=list(), NAtol=5, emissionProbs=list(), verbose=FALSE, sizeFactors=matrix(1, nrow=length(obs), ncol=ncol(obs[[1]])))

### Arguments

`hmm` | The initial Hidden Markov Model.
`obs` | The observations. A list of one or more entries containing the observation matrix (`numeric`) for the samples (e.g. chromosomes).
`NAtol` | Successive positions having NAs longer than this threshold are masked in the viterbi path.
`emissionProbs` | List of precalculated emission probabilities of emission function is of type 'null'.
`verbose` | `logical` for printing algorithm status or not.
`sizeFactors` | Library size factors for Emissions PoissonLogNormal or NegativeBinomial as a length(obs) x ncol(obs[[1]]) matrix.

### Value

A list containint the vterbi paths.

### Examples

    data(example)
    hmm_ex = initHMM(observations, nStates=3, method="Gaussian")
    hmm_fitted = fitHMM(observations, hmm_ex)
    viterbi = getViterbi(hmm_fitted, observations)

[Package STAN version 2.20.0 Index]