#################################################### # Simulation and Estimation of Markov Sequence set.seed(232453) library(hmm.discnp) sequence.length<-300 sequence.replications<-20 Pop<- matrix(c(0.90, .10, 0.10, .90), ncol=2, nrow=2, byrow=TRUE) # R is observed transition probabilities given P # # State1 State2 Obs<- matrix(c(0.24, 0.26, 0.23, 0.27, 0.26, 0.24, 0.27, 0.23), nrow=4, ncol=2, byrow=TRUE) y.sim <- sim.hmm(sequence.length,Pop,Obs,sequence.replications) head(y.sim) hmm.results<-hmm(y.sim,K=2,verb=T) hmm.results # Rho- The fitted value of the probability matrix # Rho specifying the distributions of the observations. # # tpm - The fitted value of the transition probabilty matrix # # ispd - The fitted initial state probability distribution, # assumed to be the (unique) stationary distribution # for the chain, and thereby determined by the transition # probability matrix tpm.