# NOT RUN {
tmat = matrix(c(0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0),
5,5, byrow= TRUE ) #for "X" (5 nodes) shaped tree
hmmA = initHMM(c("P","N"),list(c("L","R")), tmat) #one feature with two discrete levels "L" and "R"
obsv = list(c("L","L","R","R","L")) #emissions for the one feature for the 5 nodes in order 1:5
ft_sq = fwd_seq_gen(hmmA)
kn_st = data.frame(node=c(3),state=c("P"),stringsAsFactors = FALSE)
#state at node 3 is known to be "P"
ForwardProbs = forward(hmmA,obsv,ft_sq,kn_st)
# }
Run the code above in your browser using DataLab