hmhmm | R Documentation |
This function implements a Metropolis within Gibbs algorithm that produces
a sample on the parameters p_{ij} and q^i_j of the hidden Markov
model (Chapter 7). It includes a function likej
that computes the likelihood of
the times series using a forward-backward algorithm.
hmhmm(M = 100, y)
M |
Number of Gibbs iterations |
y |
times series to be modelled by a hidden Markov model |
The Metropolis-within-Gibbs step involves Dirichlet proposals with a random choice of the scale between 1 and 1e5.
BigR |
matrix of the iterated values returned by the MCMC algorithm containing p_{11} and p_{22}, transition probabilities, and q^1 and q^2, vector of probabilities for both latent states |
olike |
sequence of the log-likelihoods produced by the MCMC sequence |
res=hmhmm(M=500,y=sample(1:4,10,rep=TRUE)) plot(res$olike,type="l",main="log-likelihood",xlab="iterations",ylab="")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.