forward: Computes the forward probabilities

View source: R/HMM.r

forwardR Documentation

Computes the forward probabilities

Description

The forward-function computes the forward probabilities. The forward probability for state X up to observation at time k is defined as the probability of observing the sequence of observations e_1, ... ,e_k and that the state at time k is X. That is:
f[X,k] := Prob(E_1 = e_1, ... , E_k = e_k , X_k = X).
Where E_1...E_n = e_1...e_n is the sequence of observed emissions and X_k is a random variable that represents the state at time k.

Usage

forward(hmm, observation)

Arguments

hmm

A Hidden Markov Model.

observation

A sequence of observations.

Format

Dimension and Format of the Arguments.

hmm

A valid Hidden Markov Model, for example instantiated by initHMM.

observation

A vector of strings with the observations.

Value

Return Value:

forward

A matrix containing the forward probabilities. The probabilities are given on a logarithmic scale (natural logarithm). The first dimension refers to the state and the second dimension to time.

Author(s)

Lin Himmelmann <hmm@linhi.com>, Scientific Software Development

References

Lawrence R. Rabiner: A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE 77(2) p.257-286, 1989.

See Also

See backward for computing the backward probabilities.

Examples

# Initialise HMM
hmm = initHMM(c("A","B"), c("L","R"), transProbs=matrix(c(.8,.2,.2,.8),2),
	emissionProbs=matrix(c(.6,.4,.4,.6),2))
print(hmm)
# Sequence of observations
observations = c("L","L","R","R")
# Calculate forward probablities
logForwardProbabilities = forward(hmm,observations)
print(exp(logForwardProbabilities))

HMM documentation built on March 23, 2022, 5:06 p.m.

Related to forward in HMM...