Example from the package HiddenMarkov

library("HiddenMarkov") #включили пакет Pi <- matrix(c(1/2, 1/2, 0, 1/3, 1/3, 1/3, 0, 1/2, 1/2), byrow=TRUE, nrow=3) 

Pi - m * m - matrix, the transition probability of a homogeneous hidden Markov chain

 delta <- c(0, 1, 0, 0, 0) 

delta is the boundary probability distribution m of hidden states at (first time point) - literal translation

 lambda <- c(1, 4, 2, 5, 3) 

lambda - model parameters

 m <- nrow(Pi) x <- dthmm(NULL, Pi, delta, "pois", list(lambda=lambda), discrete=TRUE) 

create hidden Markov chain (object of class dthmm)

 x <- simulate(x, nsim=2000) 

Simulate the date of random values

------ Global Decoding ------

 states <- Viterbi(x) 

determine the state of the model

 states <- factor(states, levels=1:m) 

number of states ??? Compare predicted states with true states

 p[j,k] = Pr{Viterbi predicts state k | true state is j} p <- matrix(NA, nrow=m, ncol=m) for (j in 1:m){ a <- (x$y==j) p[j,] <- table(states[a])/sum(a) } print(p) 

Compare and select the correct states

Actually questions:

How are the Lambda model parameters selected? What is delta, why is it needed and how are the parameters set? How to access model parameters and evaluate quality? How then to run the model on a test sample?

I ask for advice. thank

    0