function probs = probOfEvent(e)
% PROBOFEVENT calculates the probability of
% the event e occuring, given that a bayesian model
% produced it for the 3 models.

probs = [0.0; 0.0; 0.0];

% MODEL 1
% A,B,C
if e(1)
    p1 = 0.2;
    p1 = p1 * ifv(e(2),0.25,0.75);
    p1 = p1 * ifv(e(3),0.1,0.9);
else
    p1 = 0.8;
    p1 = p1 * ifv(e(2),0.05,0.95);
    p1 = p1 * ifv(e(3),0.05,0.95);
end
% D
if e(2)
    if e(3)
        p1 = p1 * ifv(e(4),0.75,0.25);
    else
        p1 = p1 * ifv(e(4),0.1,0.9);     
    end
else 
    if e(3)
        p1 = p1 * 0.5;
    else 
        p1 = p1 * ifv(e(4),0.05,0.95);
    end
end
% E
if e(3)
    p1 = p1 * ifv(e(5),0.6,0.4);
else
    p1 = p1 * ifv(e(5),0.05,0.95);
end
probs(1,1) = p1;

% MODEL 2
% A,B
p2 = ifv(e(1),0.2,0.8);
p2 = p2 * ifv(e(2),0.2,0.8);
% C
if e(1)
    if e(2)
        p2 = p2 * ifv(e(3),0.25,0.75);
    else
        p2 = p2 * ifv(e(3),0.05,0.95);
    end
else
    if e(2)
        p2 = p2 * ifv(e(3),0.2,0.8);
    else
        p2 = p2 * ifv(e(3),0.05,0.95);
    end
end
% D,E
if e(3)
    p2 = p2 * ifv(e(4),0.6,0.4);
    p2 = p2 * ifv(e(5),0.6,0.4);
else
    p2 = p2 * ifv(e(4),0.1,0.9);
    p2 = p2 * ifv(e(5),0.05,0.95);
end
probs(2,1) = p2;

% MODEL 3
% A
p3 = ifv(e(1),0.2,0.8);
% B,C
if e(1)
    p3 = p3 * ifv(e(2),0.25,0.75);
    if e(2)
        p3 = p3 * ifv(e(3),0.25,0.75);
    else
        p3 = p3 * ifv(e(3),0.05,0.95);
    end
else
    p3 = p3 * ifv(e(2),0.05,0.95);
    if e(2)
        p3 = p3 * ifv(e(3),0.2,0.8);
    else
        p3 = p3 * ifv(e(3),0.05,0.95);
    end
end
% D,E
if e(3)
    p3 = p3 * ifv(e(5),0.6,0.4);
    if e(2)
        p3 = p3 * ifv(0.75,0.25);
    else
        p3 = p3 * 0.5;
    end
else
    p3 = p3 * ifv(e(5),0.05,0.95);
    if e(2)
        p3 = p3 * ifv(e(5),0.1,0.9);
    else
        p3 = p3 * ifv(e(5),0.05,0.95);
    end
end
probs(3,1) = p3;