decode_states {fHMM} | R Documentation |
Decode the underlying hidden state sequence
Description
This function decodes the (most likely) underlying hidden state sequence by applying the Viterbi algorithm for global decoding.
Usage
decode_states(x, verbose = TRUE)
viterbi(observations, nstates, sdd, Gamma, mu, sigma = NULL, df = NULL)
Arguments
x |
An object of class |
verbose |
Set to |
observations |
A |
nstates |
The number of states. |
sdd |
A
|
Gamma |
A transition probability |
mu |
A For the gamma- or Poisson-distribution, |
sigma |
A positive Not relevant in case of a state-dependent Poisson distribution. |
df |
A positive Only relevant in case of a state-dependent t-distribution. |
Value
An object of class fHMM_model
with decoded state sequence
included.
References
https://en.wikipedia.org/wiki/Viterbi_algorithm
Examples
decode_states(dax_model_3t)
plot(dax_model_3t, type = "ts")
viterbi(
observations = c(1, 1, 1, 10, 10, 10),
nstates = 2,
sdd = "poisson",
Gamma = matrix(0.5, 2, 2),
mu = c(1, 10)
)