Hi, I am having difficulties estimating the parameters of a HMM using the HMM package. I have simulated a sequence of observations from a known HMM. When I estimate the parameters of a HMM using these simulated observations the parameters are not at all close to the known ones. I realise the estimated parameters are not going to be exactly the same as the known/true parameters, but these are nowhere close. Below is my code used. Any ideas or possible suggestions regarding this issue would be greatly appreciated?
library(HMM) ## DECLARE PARAMETERS OF THE KNOWN MODEL states = c(1,2,3) symbols = c(1,2) startProb = c(0.5,0.25,0.25) transProb = matrix(c(0.8,0.05,0.15,0.2,0.6,0.2,0.2,0.3,0.5),3,3,TRUE) emissionProb = matrix(c(0.9,0.1,0.2,0.8,0.7,0.3), 3,2,TRUE) # CREATE THE KNOWN MODEL hmmTrue = initHMM(states, symbols, startProb, transProb , emissionProb) # SIMULATE 1000 OBSERVATIONS OF THE KNOWN MODEL observation = simHMM(hmmTrue, 1000) obs = observation$observation #ESTIMATE A MODEL USING THE OBSERVATIONS GENERATED FROM THE KNOWN MODEL hmmInit = initHMM(states, symbols, c(1/3,1/3,1/3)) hmmFit = baumWelch(hmmInit, obs) #The parameters of hmmTrue and hmmFit are not at all alike, why is this? Kind Regards, Richard [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.