[R] Hidden Markov Chains - mhsmm

Lui ## lui.r.project at googlemail.com
Fri Jun 17 09:47:17 CEST 2011


Dear R-Users,

I am currently trying my luck with Hidden Markov Chains and use the
package mhsmm. I was very "shocked" to see how the initial values for
the transition matrix and probability distributions affected the
outcomes. The results were extremely different even for small changes
in the initial parameter settings. I would usually start with a "rough
guesstimate" which seemed to work quite well:

data.hsmm <- list(x=as.numeric(data),N=nrow(data))
J <- 2 # 2 Regimes
P0 <- matrix(c(0.99,0.01,0.03,0.97), nrow=J,ncol=J)
b0 <- list(mu=c(0.05,-0.05),sigma=c(0.001,0.005)) # first regime has
positive return and lwoer variance than second one; initiating values
init0 <- c(0.5,0.5) # Initial starting probabilities
startval <- hmmspec(init=init0, trans=P0, parms.emis=b0, dens.emis=dnorm.hsmm)
tryCatch(regime <- hmmfit(data.hsmm, startval,
mstep=mstep.norm,tol=1e-10),error=function(err) return(0))

Since it is a larger set of data (several different objects that are
observed) the initial values need to be chosen "across all items to be
evaluated". I did not see any difference when changing the tolerance
or making any changes to the number of "maximal iterations".

Any other package suggestions with which I may avoid this problem? How
are you choosing the "set up variables"?

Thank you very much in advance!

Lui



More information about the R-help mailing list