This function initialises a general discrete time and discrete space Hidden Markov Model (HMM).
A HMM consists of an alphabet of states and emission symbols. A HMM assumes that
the states are hidden from the observer, while only the emissions of the states are observable.
The HMM is designed to make inference on the states through the observation of emissions.
The stochastics of the HMM is fully described by the initial starting probabilities of the states,
the transition probabilities between states and the emission probabilities of the states.
Vector with the starting probabilities of the states.
transProbs
Stochastic matrix containing the transition probabilities between the states.
emissionProbs
Stochastic matrix containing the emission probabilities of the states.
Format
Dimension and Format of the Arguments.
States
Vector of strings.
Symbols
Vector of strings.
startProbs
Vector with the starting probabilities of the states.
The entries must sum to 1.
transProbs
transProbs is a (number of states)x(number of states)-sized
matrix, which contains the transition probabilities between states.
The entry transProbs[X,Y] gives the probability of a transition
from state X to state Y. The rows of the matrix must sum to 1.
emissionProbs
emissionProbs is a (number of states)x(number of states)-sized
matrix, which contains the emission probabilities of the states.
The entry emissionProbs[X,e] gives the probability of emission
e from state X. The rows of the matrix must sum to 1.
Details
In transProbs and emissionProbs NA's can be used in order to forbid
specific transitions and emissions. This might be useful for Viterbi training or
the Baum-Welch algorithm when using pseudocounts.
Value
The function initHMM returns a HMM that consists of a list of 5 elements:
States
Vector with the names of the states.
Symbols
Vector with the names of the symbols.
startProbs
Annotated vector with the starting probabilities of the states.
transProbs
Annotated matrix containing the transition probabilities between the states.
emissionProbs
Annotated matrix containing the emission probabilities of the states.
Author(s)
Lin Himmelmann <hmm@linhi.com>, Scientific Software Development
References
For an introduction in the HMM-literature see for example:
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.
Olivier Cappe, Eric Moulines, Tobias Ryden: Inference in Hidden Markov Models. Springer. ISBN 0-387-40264-0.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HMM)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HMM/initHMM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: initHMM
> ### Title: Initialisation of HMM's
> ### Aliases: initHMM
> ### Keywords: models
>
> ### ** Examples
>
> # Initialise HMM nr.1
> initHMM(c("X","Y"), c("a","b","c"))
$States
[1] "X" "Y"
$Symbols
[1] "a" "b" "c"
$startProbs
X Y
0.5 0.5
$transProbs
to
from X Y
X 0.75 0.25
Y 0.25 0.75
$emissionProbs
symbols
states a b c
X 0.3333333 0.3333333 0.3333333
Y 0.3333333 0.3333333 0.3333333
> # Initialise HMM nr.2
> initHMM(c("X","Y"), c("a","b"), c(.3,.7), matrix(c(.9,.1,.1,.9),2),
+ matrix(c(.3,.7,.7,.3),2))
$States
[1] "X" "Y"
$Symbols
[1] "a" "b"
$startProbs
X Y
0.3 0.7
$transProbs
to
from X Y
X 0.9 0.1
Y 0.1 0.9
$emissionProbs
symbols
states a b
X 0.3 0.7
Y 0.7 0.3
>
>
>
>
>
> dev.off()
null device
1
>