### R code from vignette source 'DHMM1.Rnw' ### Encoding: NA ################################################### ### code chunk number 1: DHMM1.Rnw:29-31 ################################################### options("width"=80) library(mhsmm) ################################################### ### code chunk number 2: DHMM1.Rnw:49-50 ################################################### y1 <- c(1,1,1,1,2,1,1,NA,1,1,2,1,1,1,2,1,1,1,1,1,2,2,2,2,1,2,2,2,1,2,2,2,1,1,1,1,1,1,1,1,2,2,2,1,1) ################################################### ### code chunk number 3: DHMM1.Rnw:55-56 ################################################### obj <- smooth.discrete(y1) ################################################### ### code chunk number 4: smooth1 ################################################### plot(y1, ylim=c(0.8,2)) addStates(obj$s) ################################################### ### code chunk number 5: DHMM1.Rnw:80-82 ################################################### y2 <- c(1,1,1,1,2,2,2,1,1,2,1,1,1,2,1,1,1,1,1,2,2,2,NA,1,1,1,2,2,1,2,2,2) predict(obj,x=y2) ################################################### ### code chunk number 6: DHMM1.Rnw:92-93 ################################################### summary(obj) ################################################### ### code chunk number 7: DHMM1.Rnw:104-105 ################################################### args(smooth.discrete) ################################################### ### code chunk number 8: DHMM1.Rnw:115-116 ################################################### table(y1)/sum(table(y1)) ################################################### ### code chunk number 9: DHMM1.Rnw:122-125 ################################################### ttt<-table(y1[-length(y1)],y1[-1]) ttt sweep(ttt, 1, rowSums(ttt), "/") ################################################### ### code chunk number 10: DHMM1.Rnw:136-137 ################################################### createTransition(c(0.8,0.9),2)