Chapter 6: evidence in the balanced case

When the prior probabilities of each model allow for only a single point in the parameter space, the evidence calculation reduces to a log-transform of the likelihood ratio based on the maximum attainable likelihoods under the two models. This was exactly the lever-pressing example from the rat experiment above.

%%% press-by-press calculation

rho1=.9; rho2=.8;

N=20; S=17; dat=permlist([ones(1,S) zeros(1,N-S)]);

EV=cell(2,1);

for i=1:length(dat),

datnow=dat(1:i); %for the first i data

B1=rho1.^sum(datnow).*(1-rho1).^sum(~datnow); %Bernoulli prob: high-rate

B2=rho2.^sum(datnow).*(1-rho2).^sum(~datnow); %Bernoulli prob: high-rate

EV{1}(i)=10*log10(B1/B2); end %the i’th evidence value

%%% all-at-once calculation

B1=rho1.^sum(dat).*(1-rho1).^sum(~dat); %Bernoulli prob: high-rate

B2=rho2.^sum(dat).*(1-rho2).^sum(~dat); %Bernoulli prob: high-rate

EV{2}=10*log10(B1/B2);

%%% compare the two calculations

isnear(EV{1}(end),EV{2})