1 % To compute the model likelihood for a single observation, we add together
\r
2 % the probabilities of each of the underlying Markov Chains multiplied by
\r
4 function likelihood = model_likelihood(observation, model)
\r
6 likelihood_vect = zeros(model.num_mcs, 1);
\r
7 for i=1:model.num_mcs
\r
8 likelihood_vect(i) = model.priors(i) * chain_likelihood(observation, model.chain(i));
\r
11 likelihood = sum(likelihood_vect);
\r
13 % The likelihood of the observation for a single Markov Chain
\r
14 %function likelihood = chain_likelihood(observation, mc)
\r
15 %ikelihood = mc.t(observation(1));
\r
16 %for i=2:size(observation, 2)
\r
17 % likelihood = likelihood * mc.T(observation(i-1), observation(i));
\r