HMMGraphicDiag | R Documentation |
This function plots the kernel density of the observations and the normal (mixture of normal, discrete) density with estimated parameters for each hidden states.
HMMGraphicDiag(vit, HMM, obs, color="green")
vit |
A ViterbiClass object which gives the hidden states |
HMM |
A HMMClass or a HMMFitClass object which describes the model |
obs |
The vector, list of vectors of observations |
color |
Color for the kernel density plot |
None.
HMMGraphicDiag is not implemented for multivariate distributions.
The kernel densities of observations for each hidden states of the model are plotting using:
plot(density(obs[vit$states=i])) and i in 1..HMM$nStates (or HMM$HMM$nStates)
HMMFit, viterbi
data(n1d_3s)
obs <- obs_n1d_3s
#Fits an 3 states gaussian model
ResFit <- HMMFit(obs, nStates=3)
VitPath <- viterbi(ResFit, obs)
# Graphic diagnostic
HMMGraphicDiag(VitPath, ResFit, obs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.