Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/KPMstats/multinomial_prob.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function B = eval_pdf_cond_multinomial(data, obsmat) |
wolffd@0 | 2 % EVAL_PDF_COND_MULTINOMIAL Evaluate pdf of conditional multinomial |
wolffd@0 | 3 % function B = eval_pdf_cond_multinomial(data, obsmat) |
wolffd@0 | 4 % |
wolffd@0 | 5 % Notation: Y = observation (O values), Q = conditioning variable (K values) |
wolffd@0 | 6 % |
wolffd@0 | 7 % Inputs: |
wolffd@0 | 8 % data(t) = t'th observation - must be an integer in {1,2,...,K}: cannot be 0! |
wolffd@0 | 9 % obsmat(i,o) = Pr(Y(t)=o | Q(t)=i) |
wolffd@0 | 10 % |
wolffd@0 | 11 % Output: |
wolffd@0 | 12 % B(i,t) = Pr(y(t) | Q(t)=i) |
wolffd@0 | 13 |
wolffd@0 | 14 [Q O] = size(obsmat); |
wolffd@0 | 15 T = prod(size(data)); % length(data); |
wolffd@0 | 16 B = zeros(Q,T); |
wolffd@0 | 17 |
wolffd@0 | 18 for t=1:T |
wolffd@0 | 19 B(:,t) = obsmat(:, data(t)); |
wolffd@0 | 20 end |