Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

viterbi.msm

Calculate the probabilities of underlying states and the most likely path through them


Description

For a fitted hidden Markov model, or a model with censored state observations, the Viterbi algorithm recursively constructs the path with the highest probability through the underlying states. The probability of each hidden state is also computed for hidden Markov models.

Usage

viterbi.msm(x, normboot=FALSE)

Arguments

x

A fitted hidden Markov multi-state model, or a model with censored state observations, as produced by msm

normboot

If TRUE, then before running the algorithm, the maximum likelihood estimates of the model parameters are replaced by an alternative set of parameters drawn randomly from the asymptotic multivariate normal distribution of the MLEs.

Value

A data frame with columns:

subject = subject identification numbers

time = times of observations

observed = corresponding observed states

fitted = corresponding fitted states found by Viterbi recursion. If the model is not a hidden Markov model and there are no censored state observations, this is just the observed states.

For hidden Markov models, an additional matrix pstate is also returned inside the data frame, giving the probability of each hidden state at each point, conditionally on all the data. This is computed by the forward/backward algorithm.

Author(s)

References

Durbin, R., Eddy, S., Krogh, A. and Mitchison, G. Biological sequence analysis, Cambridge University Press, 1998.

See Also


msm

Multi-State Markov and Hidden Markov Models in Continuous Time

v1.6.8
GPL (>= 2)
Authors
Christopher Jackson <chris.jackson@mrc-bsu.cam.ac.uk>
Initial release
2019-12-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.