Question
I am new to using R and i have to use the Viterbi algorithm to calculate the hidden states. the problem is the program is
I am new to using R and i have to use the Viterbi algorithm to calculate the hidden states. the problem is the program is not reading my transition probailities correctly. below is all the information i have
b) Use zero order Markov models defined for sequence1_A2 and sequence2_A2 and apply Viterbi algorithm to find the most likely path for sequence CGCGTTCATTCAATG in frame 1 only (45 pts)
Assume:
Initial transition probabilities
a0c= a0n.5
ann= anc.5
acc.55 acn= 0.45
where, aijis transition probability, c- coding, n-non-coding. the second probaility (on the right is for non coding)
cn
P(A)= 281/.204P(A)= 107/.195
P(T)/.144P(T)/.186
P(G)/.354P(G)/.333
P(C)/.298 P(C)/.284
below is the script i use and the result i get in R:
# Initialise HMM > hmm = initHMM(c("C","N"), c("A","T","G","C"), transProbs=matrix(c(.20,.14,.34,.29),2), + emissionProbs=matrix(c(.19,.18,.33,.28),2)) > > > print(hmm) $States [1] "C" "N" $Symbols [1] "A" "T" "G" "C" $startProbs C N 0.5 0.5 $transProbs to from C N C 0.20 0.34 N 0.14 0.29 $emissionProbs symbols states A T G C C 0.19 0.33 0.19 0.33 N 0.18 0.28 0.18 0.28 > # Sequence of observations > observations = c("C","G","C","G","T","T","C","A","T","T","C","A","A","T","G") > # Calculate Viterbi path > viterbi = viterbi(hmm,observations) > print(viterbi) [1] "C" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N" "N"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started