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

hidden_paths

Most Probable Paths of Hidden States


Description

Function hidden_paths computes the most probable path of hidden states of a (mixture) hidden Markov model given the observed sequences.

Usage

hidden_paths(model)

Arguments

model

A hidden Markov model of class hmm or a mixture HMM of class mhmm.

Value

The most probable paths of hidden states as an stslist object (see seqdef). The log-probability is included as an attribute log_prob.

See Also

hmm_biofam for information on the model used in the example; and seqIplot, ssplot, or mssplot for plotting hidden paths.

Examples

# Load a pre-defined HMM
data("hmm_biofam")

# Compute the most probable hidden state paths given the data and the model
mpp <- hidden_paths(hmm_biofam)

# Plot hidden paths for the first 100 individuals
ssplot(mpp, type = "I", tlim = 1:100)

# Because the model structure is so sparse that the posterior probabilities are 
# mostly peaked to single state at each time point, the joint probability of 
# observations and most probable paths of hidden states is almost identical to 
# log-likelihood:

sum(attr(mpp, "log_prob"))
logLik(hmm_biofam)

seqHMM

Mixture Hidden Markov Models for Social Sequence Data and Other Multivariate, Multichannel Categorical Time Series

v1.0.14
GPL (>= 2)
Authors
Jouni Helske [aut, cre] (<https://orcid.org/0000-0001-7130-793X>), Satu Helske [aut] (<https://orcid.org/0000-0003-0532-0153>)
Initial release
2019-10-21

We don't support your browser anymore

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