getViterbi: Calculate the most likely state path

Description Usage Arguments Value Examples

View source: R/getViterbi.R

Description

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

Usage

1
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

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

STAN documentation built on Nov. 8, 2020, 11:11 p.m.