transitions <- matrix(data = 1/3, ncol = 3, nrow = 3)
loglikelihood <- matrix(c(rep(c(0, -10, -10), 3),
rep(c(-10, -10, 0), 3),
rep(c(-10, 0, -10), 4)), nrow = 3)
## note the final 0 state, enforced by the code
viterbi.hmm(transitions, t(loglikelihood), positions = 1:10, expected.CNV.length = 1)
## Now we cannot transition out of 0 and should have no call
transitions <- matrix(c(1, 0, 0, 0, 1, 0, 0, 0, 1), ncol = 3)
## we can check that no call is made
viterbi.hmm(transitions, t(loglikelihood), positions = 1:10, expected.CNV.length = 1)
Run the code above in your browser using DataLab