\documentclass[pdf,bndg,slideColor,colorBG]{prosper}

\input{preamble}

\title{Bayesian Networks and Decision Graphs}
\subtitle{}
\author{}
\email{}
\institution{Chapter 3}
\slideCaption{Chapter 3}


\begin{document}
\maketitle




%####################################################################################
%# Building models
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Building models}
\fromSlide*{1}{
Milk from a cow may be infected. To detect whether or not the milk is
infected, you can apply a test which may either give a positive or
a negative test result. The test is not perfect: It may give
\ul{\Purple{false positives}} as well as \ul{\Purple{false negatives}}.
\ \\
\ \\
\ \\
\ \\
} 

\fromSlide{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(26,4)

\rput(6,2){\ovalnode{h}{
\begin{tabular}{c}
Hypothesis events\\
\Blue{Inf:} \Red{y},\Red{n}			
\end{tabular}}}

\rput(20,2){\ovalnode{i}{
\begin{tabular}{c}
Information events\\
\Blue{Test:} \Red{pos},\Red{neg}			
\end{tabular}}}

\arc{h}{i}

\end{pspicture}
\end{center}
}

\end{slide}
}
}
{

\begin{slide}{Building models}

Milk from a cow may be infected. To detect whether or not the milk is
infected, you can apply a test which may either give a positive or
a negative test result. The test is not perfect: It may give
\ul{\Purple{false positives}} as well as \ul{\Purple{false negatives}}.
\ \\
\ \\
\ \\
\ \\
 
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(26,4)

\rput(6,2){\ovalnode{h}{
\begin{tabular}{c}
Hypothesis events\\
\Blue{Inf:} \Red{y},\Red{n}			
\end{tabular}}}

\rput(20,2){\ovalnode{i}{
\begin{tabular}{c}
Information events\\
\Blue{Test:} \Red{pos},\Red{neg}			
\end{tabular}}}

\arc{h}{i}

\end{pspicture}
\end{center}


\end{slide}

}
%####################################################################################
%# $7$-day model I
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{$7$-day model I}
\fromSlide*{1}{
\ul{Infections develop over time:}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,7)

\Fnode{2}{6}{i1}{$\mbox{Inf}_1$}
\Fnode{2}{2}{t1}{$\mbox{Test}_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$\mbox{Inf}_2$}
\Fnode{6}{2}{t2}{$\mbox{Test}_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$\mbox{Inf}_3$}
\Fnode{10}{2}{t3}{$\mbox{Test}_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$\mbox{Inf}_4$}
\Fnode{14}{2}{t4}{$\mbox{Test}_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$\mbox{Inf}_5$}
\Fnode{18}{2}{t5}{$\mbox{Test}_5$}
\arc{i5}{t5}

\Fnode{22}{6}{i6}{$\mbox{Inf}_6$}
\Fnode{22}{2}{t6}{$\mbox{Test}_6$}
\arc{i6}{t6}

\Fnode{26}{6}{i7}{$\mbox{Inf}_7$}
\Fnode{26}{2}{t7}{$\mbox{Test}_7$}
\arc{i7}{t7}

\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}
\arc{i5}{i6}
\arc{i6}{i7}

%\showgrid
\end{pspicture}
\end{center}
} 

\fromSlide{2}{
\ul{Assumption:}
\begin{itemize}
\item The \Purple{Markov property:} If I know the present, then the past
has no influence on the future, i.e.
$$
\Blue{\mbox{Inf}_{i-1}}\text{ is d-separated from }\Blue{\mbox{Inf}_{i+1}}\text{ given }\Blue{\mbox{Inf}_{i}}.  
$$
\end{itemize}
\ \\
\ \\
\Red{
\begin{center}
But what if yesterday's Inf-state has an impact on 
tomorrow's Inf-state? 
\end{center}}

}

\end{slide}}
}
{
\begin{slide}{$7$-day model I}

\ul{Infections develop over time:}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,7)

\Fnode{2}{6}{i1}{$\mbox{Inf}_1$}
\Fnode{2}{2}{t1}{$\mbox{Test}_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$\mbox{Inf}_2$}
\Fnode{6}{2}{t2}{$\mbox{Test}_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$\mbox{Inf}_3$}
\Fnode{10}{2}{t3}{$\mbox{Test}_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$\mbox{Inf}_4$}
\Fnode{14}{2}{t4}{$\mbox{Test}_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$\mbox{Inf}_5$}
\Fnode{18}{2}{t5}{$\mbox{Test}_5$}
\arc{i5}{t5}

\Fnode{22}{6}{i6}{$\mbox{Inf}_6$}
\Fnode{22}{2}{t6}{$\mbox{Test}_6$}
\arc{i6}{t6}

\Fnode{26}{6}{i7}{$\mbox{Inf}_7$}
\Fnode{26}{2}{t7}{$\mbox{Test}_7$}
\arc{i7}{t7}

\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}
\arc{i5}{i6}
\arc{i6}{i7}

%\showgrid
\end{pspicture}
\end{center}


\ul{Assumption:}
\begin{itemize}
\item The \Purple{Markov property:} If I know the present, then the past
has no influence on the future, i.e.
$$
\Blue{\mbox{Inf}_{i-1}}\text{ is d-separated from }\Blue{\mbox{Inf}_{i+1}}\text{ given }\Blue{\mbox{Inf}_{i}}.  
$$
\end{itemize}
\ \\
\ \\
\Red{
\begin{center}
But what if yesterday's Inf-state has an impact on 
tomorrow's Inf-state? 
\end{center}}


\end{slide}


}
%####################################################################################
%# $7$-day model II
%####################################################################################


\begin{slide}{$7$-day model II}

\Purple{Yesterday's Inf-state has an impact on 
tomorrow's Inf-state:}


\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,8)

\Fnode{2}{6}{i1}{$\mbox{Inf}_1$}
\Fnode{2}{2}{t1}{$\mbox{Test}_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$\mbox{Inf}_2$}
\Fnode{6}{2}{t2}{$\mbox{Test}_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$\mbox{Inf}_3$}
\Fnode{10}{2}{t3}{$\mbox{Test}_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$\mbox{Inf}_4$}
\Fnode{14}{2}{t4}{$\mbox{Test}_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$\mbox{Inf}_5$}
\Fnode{18}{2}{t5}{$\mbox{Test}_5$}
\arc{i5}{t5}

\Fnode{22}{6}{i6}{$\mbox{Inf}_6$}
\Fnode{22}{2}{t6}{$\mbox{Test}_6$}
\arc{i6}{t6}

\Fnode{26}{6}{i7}{$\mbox{Inf}_7$}
\Fnode{26}{2}{t7}{$\mbox{Test}_7$}
\arc{i7}{t7}

\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}
\arc{i5}{i6}
\arc{i6}{i7}


\ncarc[linecolor=green]{->}{i1}{i3}
\ncarc[linecolor=green]{->}{i2}{i4}
\ncarc[linecolor=green]{->}{i3}{i5}
\ncarc[linecolor=green]{->}{i4}{i6}
\ncarc[linecolor=green]{->}{i5}{i7}
%\showgrid
\end{pspicture}
\end{center}



\end{slide}

%####################################################################################
%# $7$-day model III
%####################################################################################


\begin{slide}{$7$-day model III}

\Purple{The test-failure is \ul{dependent} on whether or not the test failed yesterday:}


\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,8)

\Fnode{2}{6}{i1}{$\mbox{Inf}_1$}
\Fnode{2}{2}{t1}{$\mbox{Test}_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$\mbox{Inf}_2$}
\Fnode{6}{2}{t2}{$\mbox{Test}_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$\mbox{Inf}_3$}
\Fnode{10}{2}{t3}{$\mbox{Test}_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$\mbox{Inf}_4$}
\Fnode{14}{2}{t4}{$\mbox{Test}_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$\mbox{Inf}_5$}
\Fnode{18}{2}{t5}{$\mbox{Test}_5$}
\arc{i5}{t5}

\Fnode{22}{6}{i6}{$\mbox{Inf}_6$}
\Fnode{22}{2}{t6}{$\mbox{Test}_6$}
\arc{i6}{t6}

\Fnode{26}{6}{i7}{$\mbox{Inf}_7$}
\Fnode{26}{2}{t7}{$\mbox{Test}_7$}
\arc{i7}{t7}

\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}
\arc{i5}{i6}
\arc{i6}{i7}


\ncarc[linecolor=green]{->}{i1}{i3}
\ncarc[linecolor=green]{->}{i2}{i4}
\ncarc[linecolor=green]{->}{i3}{i5}
\ncarc[linecolor=green]{->}{i4}{i6}
\ncarc[linecolor=green]{->}{i5}{i7}

\arc{t1}{t2}
\arc{t2}{t3}
\arc{t3}{t4}
\arc{t4}{t5}
\arc{t5}{t6}
\arc{t6}{t7}

\arc{i1}{t2}
\arc{i2}{t3}
\arc{i3}{t4}
\arc{i4}{t5}
\arc{i5}{t6}
\arc{i6}{t7}


%\showgrid
\end{pspicture}
\end{center}



\end{slide}

%####################################################################################
%# Soar throat
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Sore throat}

\fromSlide*{1}{
I wake up one morning with a sore throat. It may be the beginning of a
cold or I may suffer from angina. If it is a severe angina, then I
will not go to work. To gain more insight, I can take my temperature
and look down my throat for yellow spots.
\ \\
\ \\
\ \\
}
\fromSlide*{2}{
\Blue{\ul{Hypothesis variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{Cold?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{Angina?} - \Red{\{no, mild, severe\}}
\ \\
\ \\
\ \\
\Blue{\ul{Information variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{Sore throat?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{See spots?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{Fever?} - \Red{\{no, low, high\}}

}

\end{slide}
}
}
{
\begin{slide}{Sore throat}


I wake up one morning with a sore throat. It may be the beginning of a
cold or I may suffer from angina. If it is a severe angina, then I
will not go to work. To gain more insight, I can take my temperature
and look down my throat for yellow spots.
\ \\
\ \\
\ \\

\Blue{\ul{Hypothesis variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{Cold?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{Angina?} - \Red{\{no, mild, severe\}}
\ \\
\ \\
\ \\
\Blue{\ul{Information variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{Sore throat?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{See spots?} - \Red{\{n, y\}}\\
\hspace*{0.5cm}\Blue{Fever?} - \Red{\{no, low, high\}}



\end{slide}

}
%####################################################################################
%# Model for soar throat
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Model for sore throat}

\onlySlide*{1}{

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

%\showgrid
\end{pspicture}
\end{center}

}

\onlySlide*{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}

}

\end{slide}
}
}
{
\begin{slide}{Model for sore throat}



\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}



\end{slide}

}

%####################################################################################
%# Insemination of a cow
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Insemination of a cow}

\fromSlide*{1}{
Six weeks after the insemination of a cow, there are two tests:
a \Blue{Blood test} and a \Blue{Urine test}.
\ \\
\ \\

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(14,5)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,4){\ovalnode{p}{Pregnant?}}

\arc{p}{bt}
\arc{p}{ut}


%\showgrid
\end{pspicture}
\end{center}

}
\fromSlide*{2}{
\Red{\ul{Check the conditional independences:}} \\
\ \\
If we know that the cow is pregnant, will a negative blood test then
change our expectation for the urine test?
\ \\
\ \\
\begin{center}
If \Green{it will}, then the model does not reflect reality!
\end{center}

}

\end{slide}
}
}
{
\begin{slide}{Insemination of a cow}


Six weeks after the insemination of a cow, there are two tests:
a \Blue{Blood test} and a \Blue{Urine test}.
\ \\
\ \\

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(14,5)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,4){\ovalnode{p}{Pregnant?}}

\arc{p}{bt}
\arc{p}{ut}


%\showgrid
\end{pspicture}
\end{center}


\Red{\ul{Check the conditional independences:}} \\
\ \\
If we know that the cow is pregnant, will a negative blood test then
change our expectation for the urine test?
\ \\
\ \\
\begin{center}
If \Green{it will}, then the model does not reflect reality!
\end{center}



\end{slide}

}
%####################################################################################
%# Insemination of a cow: A more correct model
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Insemination of a cow: A more correct model}

\fromSlide*{1}{

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(-7,0)(14,10)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,9){\ovalnode{p}{Pregnant?}}
\rput(7,5){\ovalnode{h}{Hormonal changes}}

\arc{p}{h}
\arc{h}{ut}
\arc{h}{bt}

\rput(-4,5){\rnode[r]{t}{\Purple{Mediating variable}}}
\ncline[linecolor=magenta,linestyle=dotted]{-}{t}{h}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

But does this actually make a difference?
}
\fromSlide*{2}{

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(-15,0)(14,5)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,4){\ovalnode{p}{Pregnant?}}

\arc{p}{bt}
\arc{p}{ut}

\rput(-5.8,4){Assume that both \Blue{tests} are \Red{negative} in the \ul{incorrect} model:}
\rput(-6,3){This will overestimate the probability for \Blue{Pregnant?}=\Red{n}.}
%\showgrid
\end{pspicture}
\end{center}


}

\end{slide}
}
}
{
\begin{slide}{Insemination of a cow: A more correct model}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(-7,0)(14,10)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,9){\ovalnode{p}{Pregnant?}}
\rput(7,5){\ovalnode{h}{Hormonal changes}}

\arc{p}{h}
\arc{h}{ut}
\arc{h}{bt}

\rput(-4,5){\rnode[r]{t}{\Purple{Mediating variable}}}
\ncline[linecolor=magenta,linestyle=dotted]{-}{t}{h}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

But does this actually make a difference?

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(-15,0)(14,5)

\rput(3,1){\ovalnode{bt}{Blood test}}
\rput(11,1){\ovalnode{ut}{Urine test}}
\rput(7,4){\ovalnode{p}{Pregnant?}}

\arc{p}{bt}
\arc{p}{ut}

\rput(-5.8,4){Assume that both \Blue{tests} are \Red{negative} in the \ul{incorrect} model:}
\rput(-6,3){This will overestimate the probability for \Blue{Pregnant?}=\Red{n}.}
%\showgrid
\end{pspicture}
\end{center}


\end{slide}

}



%####################################################################################
%# Why mediating variables?
%####################################################################################


\begin{slide}{Why mediating variables?}

Why do we introduce \Var{mediating variables}:
\begin{dinglist}{228}
\item Necessary to catch the correct conditional independences.
\item Can ease the specification of the probabilities in the model.
\end{dinglist}
\ \\
\ \\

\Red{For example:} If you find that there is a dependence between two
variables \Blue{$A$} and \Blue{$B$}, but cannot determine a causal
relation: Try with a \Var{mediating variable}!

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(26,9)

\Fnode{1}{2.5}{a}{$A$}
\Fnode{6}{2.5}{b}{$B$}
\Fnode{3.5}{5.5}{c}{$C$}

\arc{c}{a}
\arc{c}{b}

\psline[linecolor=green,linestyle=dotted]{<->}(2,1)(5,1)
\rput[c](3.5,0.5){\Purple{??}}

\rput[l](8,4){\normalsize $\Rightarrow$}


\Fnode{11}{1}{a}{$A$}
\Fnode{16}{1}{b}{$B$}
\Fnode{13.5}{4}{d}{$D$}
\Fnode{13.5}{8}{c}{$C$}

\arc{d}{a}
\arc{d}{b}
\arc{c}{d}

\rput[l](17,4){\Purple{OR}}

\Fnode{20}{2}{a}{$A$}
\Fnode{25}{2}{b}{$B$}
\Fnode{20}{6}{c}{$C$}
\Fnode{25}{6}{d}{$D$}

\arc{c}{a}
\arc{c}{b}
\arc{d}{a}
\arc{d}{b}

%\showgrid
\end{pspicture}
\end{center}

\end{slide}



%####################################################################################
%# A simplified poker game
%####################################################################################

\PDForPS{
\overlays{3}{
\begin{slide}{A simplified poker game}
\fromSlide*{1}{
The game consists of:
\begin{dinglist}{228}
\item Two players.
\item Three cards to each player.
\item Two rounds of changing cards (max two cards in the second round)
\end{dinglist}
\ \\
\ \\
\Purple{
\begin{center}
What kind of hand does my opponent have?
\end{center}
}

}
\fromSlide*{2}{
\Blue{\ul{Hypothesis variable:}} \\
\ \\
\hspace*{0.5cm}\Blue{OH} - \Red{\{no, 1a, 2v, fl, st, 3v, sf\}}\\
\ \\
\ \\
\Blue{\ul{Information variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{FC} - \Red{\{0, 1, 2, 3\}} \hspace{0.5cm} and \hspace{0.5cm} \Blue{SC} - \Red{\{0, 1, 2\}}


}
\fromSlide*{3}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(3,1)(26,6)

\Fnode{7}{5}{sc}{SC}
\Fnode{4}{2}{fc}{FC}
\Fnode{10}{2}{oh}{OH}

\arc{fc}{oh}
\arc{fc}{sc}
\arc{sc}{oh}

\rput[l](12,4.5){But how do we find:}
\rput[l](12,3){$P(\Blue{\mbox{FC}})$, 
$P(\Blue{\mbox{SC}}|\Blue{\mbox{FC}})$ and $P(\Blue{\mbox{OH}}|\Blue{\mbox{SC}},\Blue{\mbox{FC}})$??} 

%\showgrid
\end{pspicture}
\end{center}
}

\end{slide}
}}
{

\begin{slide}{A simplified poker game}

The game consists of:
\begin{dinglist}{228}
\item Two players.
\item Three cards to each player.
\item Two rounds of changing cards (max two cards in the second round)
\end{dinglist}
\ \\
\ \\
\Purple{
\begin{center}
What kind of hand does my opponent have?
\end{center}
}


\Blue{\ul{Hypothesis variable:}} \\
\ \\
\hspace*{0.5cm}\Blue{OH} - \Red{\{no, 1a, 2v, fl, st, 3v, sf\}}\\
\ \\
\ \\
\Blue{\ul{Information variables:}} \\
\ \\
\hspace*{0.5cm}\Blue{FC} - \Red{\{0, 1, 2, 3\}} \hspace{0.5cm} and \hspace{0.5cm} \Blue{SC} - \Red{\{0, 1, 2\}}


\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(3,1)(26,6)

\Fnode{7}{5}{sc}{SC}
\Fnode{4}{2}{fc}{FC}
\Fnode{10}{2}{oh}{OH}

\arc{fc}{oh}
\arc{fc}{sc}
\arc{sc}{oh}

\rput[l](12,4.5){But how do we find:}
\rput[l](12,3){$P(\Blue{\mbox{FC}})$, 
$P(\Blue{\mbox{SC}}|\Blue{\mbox{FC}})$ and $P(\Blue{\mbox{OH}}|\Blue{\mbox{SC}},\Blue{\mbox{FC}})$??} 

%\showgrid
\end{pspicture}
\end{center}


\end{slide}
}

%####################################################################################
%# A simplified poker game: Mediating variables
%####################################################################################


\begin{slide}{A simplified poker game: Mediating variables}

Introduce mediating variables:
\begin{itemize}
\item The opponent's initial hand, $\Blue{\mbox{OH}_0}$.
\item The opponent's hand after the first change of cards, $\Blue{\mbox{OH}_1}$.
\end{itemize}
\ \\
\ \\

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\
\Red{Note:} The states of $\Blue{\mbox{OH}_0}$ and
$\Blue{\mbox{OH}_1}$ are different from \Blue{OH}. 

\end{slide}

%####################################################################################
%# Simple Bayes models
%####################################################################################


\begin{slide}{Na\"ive Bayes models}


\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(14,7)

\Fnode{7}{6}{h}{Hyp}
\Fnode{4}{2}{i1}{$\mbox{Inf}_1$}
\Fnode{10}{2}{in}{$\mbox{Inf}_n$}

\arc{h}{i1}
\arc{h}{in}
\psline[linecolor=black,linestyle=dotted](5.5,2)(8.5,2)

\rput[l](9,6){$P(\Blue{\mbox{Hyp}})$}
\rput[c](4,0.5){$P(\Blue{\mbox{Inf}_1}|\Blue{\mbox{Hyp}})$}
\rput[c](10,0.5){$P(\Blue{\mbox{Inf}_n}|\Blue{\mbox{Hyp}})$}


%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

We want the posterior probability of the hypothesis variable
\Blue{Hyp} given the observations $\{\Blue{\mbox{Inf}_1}=\Red{e_1},\ldots,\Blue{\mbox{Inf}_n}=\Red{e_n}\}$:
\begin{equation}\nonumber
\begin{split}
P(\Blue{\mbox{Hyp}}|\Blue{\mbox{Inf}_1}=\Red{e_1},\ldots,\Blue{\mbox{Inf}_n}=\Red{e_n})&=\frac{P(\Blue{\mbox{Inf}_1}=\Red{e_1},\ldots,\Blue{\mbox{Inf}_n}=\Red{e_n}|\Blue{\mbox{Hyp}})P(\Blue{\mbox{Hyp}})}{P(\Blue{\mbox{Inf}_1}=\Red{e_1},\ldots,\Blue{\mbox{Inf}_n}=\Red{e_n})}\\
&= \mu \cdot P(\Blue{\mbox{Inf}_1}=\Red{e_1}|\Blue{\mbox{Hyp}})\cdot
\ldots \cdot P(\Blue{\mbox{Inf}_n}=\Red{e_n}|\Blue{\mbox{Hyp}})P(\Blue{\mbox{Hyp}})
\end{split}
\end{equation}
\Red{Note:} The model assumes that the \Var{information variables} are
independent given the \Var{hypothesis variable}.


\end{slide}


%####################################################################################
%# Summary: Catching the structure
%####################################################################################

\begin{slide}{Summary: Catching the structure}

\begin{itemize}
\item[$1$.] Identify the relevant events and organize them in variables:
\Blue{
\begin{itemize}
\item[$\bullet$] Hypothesis variables \Black{-} \Red{Includes the events that
are not directly observable.} 
\item[$\bullet$] Information variables \Black{-} \Red{Information channels.}
\end{itemize}
}
\ \\
\ \\
\item[$2$.] Determine \Red{causal relations} between the variables. 
\ \\
\ \\
\item[$3$.] Check \Red{conditional independences} in the model.
\ \\
\ \\
\item[$4$.] Introduce \Red{mediating variables}.
\end{itemize}


\end{slide}



%####################################################################################
%# Where do the numbers come from?
%####################################################################################

\begin{slide}{Where do the numbers come from?}


\begin{itemize}
\item Theoretical insight. \ \\ \ \\
\item Statistics (large databases) \ \\ \ \\
\item Subjective estimates
\end{itemize}


\end{slide}

%####################################################################################
%# Infected milk
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Infected milk}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(8,3)

\Fnode{2}{2}{i1}{$\mbox{Inf}$}
\Fnode{7}{2}{t1}{$\mbox{Test}$}
\arc{i1}{t1}

%\showgrid
\end{pspicture}
\end{center}

We need the probabilities:
\begin{itemize}
\item $P(\VarM{Test}|\VarM{Inf})$ - provided by the factory. 
\item $P(\VarM{Inf})$ - cow or farm specific.
\end{itemize}
\ \\
\ \\
\begin{minipage}{\linewidth}
\ul{Determining $P(\VarM{Inf})$:} Assume that the farmer has $50$ cows. The milk is poured into a container, and
the dairy tests the milk with a \Purple{very} precise test. In average,
the milk is infected once per month.
\end{minipage}
 
\ \\
\ \\
}
\fromSlide*{2}{
\ul{\Red{Calculations:}}
\begin{equation}\nonumber
P(\VarM{\#Cows-infected}\geq 1) = \frac{1}{30} \text{ \hspace*{0.3cm}hence\hspace*{0.3cm} }
P(\VarM{\#Cows-infected}< 1) = 1-\frac{1}{30}=\frac{29}{30}.
\end{equation}
If $P(\VarM{Inf}=\St{y})=x$, then $P(\VarM{Inf}=\St{n})=(1-x)$ and:
\vspace*{-0.3cm}
\begin{equation}\nonumber
(1-x)^{50}=\frac{29}{30} \Leftrightarrow x=1-\left
(\frac{29}{30}\right )^{\frac{1}{50}}\approx 0.00067
\end{equation}
}
\end{slide}
}
}
{
\begin{slide}{Infected milk}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(8,3)

\Fnode{2}{2}{i1}{$\mbox{Inf}$}
\Fnode{7}{2}{t1}{$\mbox{Test}$}
\arc{i1}{t1}

%\showgrid
\end{pspicture}
\end{center}

We need the probabilities:
\begin{itemize}
\item $P(\VarM{Test}|\VarM{Inf})$ - provided by the factory. 
\item $P(\VarM{Inf})$ - cow or farm specific.
\end{itemize}
\ \\
\ \\

\ul{Determining $P(\VarM{Inf})$:} Assume that the farmer has $50$ cows. The milk is poured into a container, and
the dairy tests the milk with a \Purple{very} precise test. In average,
the milk is infected once per month. 
\ \\
\ \\
\ul{\Red{Calculations:}}
\begin{equation}\nonumber
P(\VarM{\#Cows-infected}\geq 1) = \frac{1}{30} \text{ \hspace*{0.3cm}hence\hspace*{0.3cm} }
P(\VarM{\#Cows-infected}< 1) = 1-\frac{1}{30}=\frac{29}{30}.
\end{equation}
If $P(\VarM{Inf}=\St{y})=x$, then $P(\VarM{Inf}=\St{n})=(1-x)$ and:
\vspace*{-0.3cm}
\begin{equation}\nonumber
(1-x)^{50}=\frac{29}{30} \Leftrightarrow x=1-\left
(\frac{29}{30}\right )^{\frac{1}{50}}\approx 0.00067
\end{equation}

\end{slide}
}

%####################################################################################
%# $7$-day model I 
%####################################################################################

\PDForPS{
\overlays{3}{
\begin{slide}{$7$-day model I}
\fromSlide*{1}{
\ul{Infections develop over time:}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,1)(8,7)

\Fovalnode[0.65cm]{2}{6}{i1}{$\mbox{Inf}_i$}
\Fovalnode[0.65cm]{2}{2}{t1}{$\mbox{Test}_i$}
\arc{i1}{t1}

\Fovalnode[0.65cm]{6}{6}{i2}{$\mbox{Inf}_{i+1}$}
\Fovalnode[0.65cm]{6}{2}{t2}{$\mbox{Test}_{i+1}$}
\arc{i2}{t2}

\arc{i1}{i2}

%\showgrid
\end{pspicture}
\end{center}
From experience we have:
\begin{itemize}
\item Risk of becoming infected? \Purple{0.0002}
\item Chance of getting cured from one day to another? \Purple{0.3}
\end{itemize}


} 

\onlySlide*{2}{
\ \\
\ul{This gives us:}
\begin{center}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_i}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Inf}_{i+1}}$} & \St{y} & \phantom{$0.7$} & \phantom{$0.0002$} \\
 & \St{n} & \phantom{0.3} & \phantom{0.9998} \\
\multicolumn{4}{c}{$P(\Var{\mbox{Inf}_{i+1}}|\Var{\mbox{Inf}_i})$}
\end{tabular}
\end{center}



}

\onlySlide*{3}{
\ \\
\ul{This gives us:}
\begin{center}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_i}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Inf}_{i+1}}$} & \St{y} & $0.7$ & $0.0002$ \\
 & \St{n} & $0.3$ & $0.9998$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Inf}_{i+1}}|\Var{\mbox{Inf}_i})$}
\end{tabular}
\end{center}



}

\end{slide}}
}
{
\begin{slide}{$7$-day model I}
\ul{Infections develop over time:}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,1)(8,7)

\Fovalnode[0.65cm]{2}{6}{i1}{$\mbox{Inf}_i$}
\Fovalnode[0.65cm]{2}{2}{t1}{$\mbox{Test}_i$}
\arc{i1}{t1}

\Fovalnode[0.65cm]{6}{6}{i2}{$\mbox{Inf}_{i+1}$}
\Fovalnode[0.65cm]{6}{2}{t2}{$\mbox{Test}_{i+1}$}
\arc{i2}{t2}

\arc{i1}{i2}

%\showgrid
\end{pspicture}
\end{center}
From experience we have:
\begin{itemize}
\item Risk of becoming infected? \Purple{0.0002}
\item Chance of getting cured from one day to another? \Purple{0.3}
\end{itemize}

\ul{This gives us:}
\begin{center}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_i}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Inf}_{i+1}}$} & \St{y} & $0.7$ & $0.0002$ \\
 & \St{n} & $0.3$ & $0.9998$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Inf}_{i+1}}|\Var{\mbox{Inf}_i})$}
\end{tabular}
\end{center}

\end{slide}



}

%####################################################################################
%# $7$-day model II 
%####################################################################################

\begin{slide}{$7$-day model II }
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(26,8)

\Fovalnode[0.65cm]{2}{6}{i1}{$\mbox{Inf}_{i-1}$}
\Fovalnode[0.65cm]{2}{2}{t1}{$\mbox{Test}_{i-1}$}
\arc{i1}{t1}

\Fovalnode[0.65cm]{6}{6}{i2}{$\mbox{Inf}_i$}
\Fovalnode[0.65cm]{6}{2}{t2}{$\mbox{Test}_i$}
\arc{i2}{t2}

\Fovalnode[0.65cm]{10}{6}{i3}{$\mbox{Inf}_{i+1}$}
\Fovalnode[0.65cm]{10}{2}{t3}{$\mbox{Test}_{i+1}$}
\arc{i3}{t3}

\arc{i1}{i2}
\arc{i2}{i3}


\ncarc[linecolor=green]{->}{i1}{i3}

\arc{t1}{t2}
\arc{t2}{t3}

\arc{i1}{t2}
\arc{i2}{t3}

\rput(20,4){
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i-1}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Inf}_{i}}$} & \St{y} & $0.6$ & $1$ \\
 & \St{n} & $0.0002$ & $0.0002$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Inf}_{i+1}}=\St{y}|\Var{\mbox{Inf}_{i-1}},\Var{\mbox{Inf}_i})$}
\end{tabular}
}
%\showgrid
\end{pspicture}
\end{center}
\ \\
\ul{That is:}
\begin{itemize}
\item An infection always lasts at least two days.
\item After two days, the chance of being cured is $0.4$.
\end{itemize}
\ \\
\ \\

\ul{However,} we also need to specify
$P(\Var{\mbox{Test}_{i+1}}|\Var{\mbox{Inf}_{i+1}},\Var{\mbox{Test}_{i}},\Var{\mbox{Inf}_{i}})$:
\begin{itemize}
\item A correct test has a $99.9\%$ of being correct the
next time.
\item An incorrect test has a $90\%$ of being incorrect the next time.
\end{itemize}
\ \\
\ \\

\Red{
\begin{center}
This can be done much easier by introducing mediating variables!
\end{center}
}

\end{slide}

%####################################################################################
%# $7$-day model III 
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{$7$-day model III}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(20,9)

\Fovalnode[0.65cm]{2}{6}{i1}{$\mbox{Inf}_{i-1}$}
\Fovalnode[0.65cm]{2}{2}{t1}{$\mbox{Test}_{i-1}$}
\arc{i1}{t1}

\Fovalnode[0.65cm]{10}{6}{i2}{$\mbox{Inf}_i$}
\Fovalnode[0.65cm]{10}{2}{t2}{$\mbox{Test}_i$}
\arc{i2}{t2}

\Fovalnode[0.65cm]{18}{6}{i3}{$\mbox{Inf}_{i+1}$}
\Fovalnode[0.65cm]{18}{2}{t3}{$\mbox{Test}_{i+1}$}
\arc{i3}{t3}

\arc{i1}{i2}
\arc{i2}{i3}

\Fovalnode[0.65cm]{6}{4}{c1}{$\mbox{Cor}_{i-1}$}
\Fovalnode[0.65cm]{14}{4}{c2}{$\mbox{Cor}_i$}


\ncarc[linecolor=green]{->}{i1}{i3}

\arc{i1}{c1}
\arc{t1}{c1}

\arc{t2}{c2}
\arc{i2}{c2}


\arc{c1}{t2}
\arc{c2}{t3}


%\showgrid
\end{pspicture}
\end{center}
\ \\
\ul{We need the probabilities:}
\ \\
\ \\

}
\onlySlide*{1}{
\begin{center}
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Test}_{i}}$} & \St{Pos} & \phantom{$1$} & \phantom{$0$} \\
 & \St{Neg} & \phantom{$0$} & \phantom{$1$} \\
\multicolumn{4}{c}{$P(\Var{\mbox{Cor}_{i}}=\St{y}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Test}_i})$}
\end{tabular}
&
\hspace*{1cm} 
&
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Cor}_{i-1}}$} & \St{y} & \phantom{$0.999$} & \phantom{$0.1$} \\
 & \St{n} & \phantom{$0.001$} & \phantom{$0.9$} \\
\multicolumn{4}{c}{$P(\Var{\mbox{Test}_{i}}=\St{Pos}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Cor}_{i-1}})$}
\end{tabular}
\end{tabular}
\end{center}
}

\onlySlide*{2}{
\begin{center}
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Test}_{i}}$} & \St{Pos} & $1$ & $0$ \\
 & \St{Neg} & $0$ & $1$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Cor}_{i}}=\St{y}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Test}_i})$}
\end{tabular}
&
\hspace*{1cm} 
&
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Cor}_{i-1}}$} & \St{y} & $0.999$ & $0.001$ \\
 & \St{n} & $0.1$ & $0.9$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Test}_{i}}=\St{Pos}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Cor}_{i-1}})$}
\end{tabular}
\end{tabular}
\end{center}
}


\end{slide}}
}
{
\begin{slide}{$7$-day model III}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(20,9)

\Fovalnode[0.65cm]{2}{6}{i1}{$\mbox{Inf}_{i-1}$}
\Fovalnode[0.65cm]{2}{2}{t1}{$\mbox{Test}_{i-1}$}
\arc{i1}{t1}

\Fovalnode[0.65cm]{10}{6}{i2}{$\mbox{Inf}_i$}
\Fovalnode[0.65cm]{10}{2}{t2}{$\mbox{Test}_i$}
\arc{i2}{t2}

\Fovalnode[0.65cm]{18}{6}{i3}{$\mbox{Inf}_{i+1}$}
\Fovalnode[0.65cm]{18}{2}{t3}{$\mbox{Test}_{i+1}$}
\arc{i3}{t3}

\arc{i1}{i2}
\arc{i2}{i3}

\Fovalnode[0.65cm]{6}{4}{c1}{$\mbox{Cor}_{i-1}$}
\Fovalnode[0.65cm]{14}{4}{c2}{$\mbox{Cor}_i$}


\ncarc[linecolor=green]{->}{i1}{i3}

\arc{i1}{c1}
\arc{t1}{c1}

\arc{t2}{c2}
\arc{i2}{c2}


\arc{c1}{t2}
\arc{c2}{t3}


%\showgrid
\end{pspicture}
\end{center}
\ \\
\ul{We need the probabilities:}
\ \\
\ \\

\begin{center}
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Test}_{i}}$} & \St{Pos} & $1$ & $0$ \\
 & \St{Neg} & $0$ & $1$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Cor}_{i}}=\St{y}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Test}_i})$}
\end{tabular}
&
\hspace*{1cm} 
&
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Inf}_{i}}$}\\ 
 & & \St{y} & \St{n}  \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Cor}_{i-1}}$} & \St{y} & $0.999$ & $0.001$ \\
 & \St{n} & $0.1$ & $0.9$ \\
\multicolumn{4}{c}{$P(\Var{\mbox{Test}_{i}}=\St{Pos}|\Var{\mbox{Inf}_{i}},\Var{\mbox{Cor}_{i-1}})$}
\end{tabular}
\end{tabular}
\end{center}
\end{slide}








}
%####################################################################################
%# Stud farm
%####################################################################################


\begin{slide}{Stud farm}

\ul{Genealogical structure for the horses in a stud farm:}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,3)(25,18)

\Fovalnode[0.6cm]{2}{17}{l}{L}
\Fovalnode[0.6cm]{7}{17}{a}{Ann}
\Fovalnode[0.6cm]{12}{17}{b}{Brian}
\Fovalnode[0.6cm]{17}{17}{c}{Cecily}
\Fovalnode[0.6cm]{22}{17}{k}{K}

\Fovalnode[0.6cm]{4.5}{13}{f}{Fred}
\Fovalnode[0.6cm]{9.5}{13}{d}{Dorothy}
\Fovalnode[0.6cm]{14.5}{13}{e}{Eric}
\Fovalnode[0.6cm]{19.5}{13}{g}{Gwen}

\Fovalnode[0.6cm]{7}{9}{h}{Henry}
\Fovalnode[0.6cm]{17}{9}{i}{Irene}

\Fovalnode[0.6cm]{12}{5}{j}{John}

\arc{l}{f}
\arc{a}{f}
\arc{a}{d}
\arc{a}{g}
\arc{b}{d}
\arc{b}{e}
\arc{c}{e}
\arc{k}{g}
\arc{f}{h}
\arc{d}{h}
\arc{e}{i}
\arc{g}{i}
\arc{h}{j}
\arc{i}{j}



\rput(16,5){\rnode[l]{t}{\St{e}}}
\ncline[linecolor=red,linestyle=dotted]{->}{t}{j}



%\showgrid
\end{pspicture}
\end{center}

We get evidence \St{e} that \Var{John} is sick.

\end{slide}



%####################################################################################
%# Stud farm: Conditional probabilities I
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Stud farm: Conditional probabilities I}

\fromSlide*{1}{
The disease is carried by a recessive gene:\newline

\centerline{
\St{aa}: sick, \hspace*{0.4cm} \St{aA}: Carrier, \hspace*{0.4cm} \St{AA}: Healthy
}
}
\onlySlide*{1}{
\ \\
\ \\
\ \\
We should specify the probabilities:

\begin{center}
\begin{tabular}{cc|ccc}
 &  & \multicolumn{3}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aa} & \St{aA} & \St{AA}   \\ \hline
\multirow{3}{0.5cm}{$\Var{\mbox{Father}}$} & \St{aa} & ( ,  , ) &
 (, , )
 & (, , )\\
 & \St{aA} & (, , ) & (, , ) & (, , )\\
 & \St{AA} & (, , ) & (, , ) & (, , )\\
\multicolumn{5}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{center}

}

\onlySlide*{2}{
\ \\
\ \\
\ \\
We should specify the probabilities:

\begin{center}
\begin{tabular}{cc|ccc}
 &  & \multicolumn{3}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aa} & \St{aA} & \St{AA}   \\ \hline
\multirow{3}{0.5cm}{$\Var{\mbox{Father}}$} & \St{aa} & (1, 0, 0) &
 (0.5, 0.5, 0)
 & (0, 1, 0)\\
 & \St{aA} & (0.5, 0.5, 0) & (0.25, 0.5, 0.25) & (0, 0.5, 0.5)\\
 & \St{AA} & (0, 1, 0) & (0, 0.5, 0.5) & (0, 0, 1)\\
\multicolumn{5}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{center}


}

\end{slide}}
}
{
\begin{slide}{Stud farm: Conditional probabilities I}
The disease is carried by a recessive gene:\newline

\centerline{
\St{aa}: sick, \hspace*{0.4cm} \St{aA}: Carrier, \hspace*{0.4cm} \St{AA}: Healthy
}
\ \\
\ \\
\ \\
We should specify the probabilities:

\begin{center}
\begin{tabular}{cc|ccc}
 &  & \multicolumn{3}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aa} & \St{aA} & \St{AA}   \\ \hline
\multirow{3}{0.5cm}{$\Var{\mbox{Father}}$} & \St{aa} & (1, 0, 0) &
 (0.5, 0.5, 0)
 & (0, 1, 0)\\
 & \St{aA} & (0.5, 0.5, 0) & (0.25, 0.5, 0.25) & (0, 0.5, 0.5)\\
 & \St{AA} & (0, 1, 0) & (0, 0.5, 0.5) & (0, 0, 1)\\
\multicolumn{5}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{center}

\end{slide}


}


%####################################################################################
%# Stud farm: Conditional probabilities II
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Stud farm: Conditional probabilities II}
\fromSlide*{1}{
\ul{But the other horses are not sick:}
\begin{itemize}
\item $\mbox{\Var{John}}$: \St{aa}, \St{aA}, \St{AA}.
\item $\mbox{\Var{Other horses}}$: \St{aA}, \St{AA}. 
\end{itemize}
\ \\
\ \\

\ul{Prior probabilities:}
\centerline{
$P(\St{aA})=0.01$ \hspace*{0.2cm} and \hspace*{0.2cm} $P(\St{AA})=0.99$.
}

\ \\
\ \\
}
\onlySlide*{1}{
\ul{Conditional probabilities:}

\begin{center}

\begin{tabular}{cc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Irene}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Henry}}$} 
 & \St{aA} &  (0.25,0.5,0.25) & (0,0.5,0.5)\\
 & \St{AA} &  (0,0.5,0.5) & (0,0,1)\\
\multicolumn{4}{c}{$P(\Var{\mbox{John}}|\Var{\mbox{Henry}},\Var{\mbox{Irene}})$}
\end{tabular}
&


\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Father}}$} 
 & \St{aA} &  ( , ) & ( , )\\
 & \St{AA} &  ( , ) & ( , )\\
\multicolumn{4}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{tabular}

\end{center}
}
\onlySlide*{2}{
\ul{Conditional probabilities:}

\begin{center}

\begin{tabular}{cc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Irene}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Henry}}$} 
 & \St{aA} &  \Green{(0.25,0.5,0.25)} & (0,0.5,0.5)\\
 & \St{AA} &  (0,0.5,0.5) & (0,0,1)\\
\multicolumn{4}{c}{$P(\Var{\mbox{John}}|\Var{\mbox{Henry}},\Var{\mbox{Irene}})$}
\end{tabular}
&


\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Father}}$} 
 & \St{aA} &  \Purple{(2/3,1/3)} & (0.5,0.5)\\
 & \St{AA} &  (0.5,0.5) & (0,1)\\
\multicolumn{4}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{tabular}

\end{center}
\ \\
\ \\

Drop the first state and normalize:
$$ 
\Green{(\, \Black{\fbox{0.25}},0.5,0.25)} \Rightarrow \Purple{(2/3,1/3)}
$$
}


\end{slide}
}
}
{
\begin{slide}{Stud farm: Conditional probabilities II}
\ul{But the other horses are not sick:}
\begin{itemize}
\item $\mbox{\Var{John}}$: \St{aa}, \St{aA}, \St{AA}.
\item $\mbox{\Var{Other horses}}$: \St{aA}, \St{AA}. 
\end{itemize}
\ \\
\ \\

\ul{Prior probabilities:}
\centerline{
$P(\St{aA})=0.01$ \hspace*{0.2cm} and \hspace*{0.2cm} $P(\St{AA})=0.99$.
}

\ \\
\ \\
\ul{Conditional probabilities:}

\begin{center}

\begin{tabular}{cc}
\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Irene}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Henry}}$} 
 & \St{aA} &  \Green{(0.25,0.5,0.25)} & (0,0.5,0.5)\\
 & \St{AA} &  (0,0.5,0.5) & (0,0,1)\\
\multicolumn{4}{c}{$P(\Var{\mbox{John}}|\Var{\mbox{Henry}},\Var{\mbox{Irene}})$}
\end{tabular}
&


\begin{tabular}{cc|cc}
 &  & \multicolumn{2}{c}{$\Var{\mbox{Mother}}$}\\ 
 & & \St{aA} & \St{AA}   \\ \hline
\multirow{2}{0.5cm}{$\Var{\mbox{Father}}$} 
 & \St{aA} &  \Purple{(2/3,1/3)} & (0.5,0.5)\\
 & \St{AA} &  (0.5,0.5) & (0,1)\\
\multicolumn{4}{c}{$P(\Var{\mbox{Offspring}}|\Var{\mbox{Father}},\Var{\mbox{Mother}})$}
\end{tabular}

\end{tabular}

\end{center}
\ \\
\ \\

Drop the first state and normalize:
$$ 
\Green{(\, \Black{\fbox{0.25}},0.5,0.25)} \Rightarrow \Purple{(2/3,1/3)}
$$
\end{slide}


}

%####################################################################################
%# A simplified poker game I
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{A simplified poker game I}
\onlySlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}

In order to find:
\begin{equation}\nonumber
P(\Var{\mbox{OH}_0})=( 
\text{\_\_}_{\St{\mbox{No}}},
\text{\_\_}_{\St{\mbox{1a}}}, \text{\_\_}_{\St{\mbox{2cons}}},
\text{\_\_}_{\St{\mbox{2s}}}, \text{\_\_}_{\St{\mbox{2v}}},
\text{\_\_}_{\St{\mbox{fl}}}, \text{\_\_}_{\St{\mbox{st}}},
\text{\_\_}_{\St{\mbox{3v}}}, \text{\_\_}_{\St{\mbox{sf}}})
\end{equation}
we have to go into combinatorics:$
\frac{\#\text{good}}{\binom{52}{3}}
$. 

}
\onlySlide*{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}

\begin{equation}\nonumber
\hspace*{-0.4cm}P(\Var{\mbox{OH}_0})\approx( 
\text{0.167}_{\St{\mbox{No}}},
\text{0.045}_{\St{\mbox{1a}}}, \text{0.064}_{\St{\mbox{2cons}}},
\text{0.466}_{\St{\mbox{2s}}}, \text{0.169}_{\St{\mbox{2v}}},
\text{0.049}_{\St{\mbox{fl}}}, \text{0.035}_{\St{\mbox{st}}},
\text{0.002}_{\St{\mbox{3v}}}, \text{0.002}_{\St{\mbox{sf}}})
\end{equation}
we have to go into combinatorics:$
\frac{\#\text{good}}{\binom{52}{3}}
$. 
For example,
\[
P(\Var{\mbox{OH}_0}=\St{\mbox{st}})=\frac{54\cdot 4\cdot 4-52}{\binom{52}{3}}.
\]

Similar considerations apply to $P(\Var{\mbox{OH}_1}|\Var{\mbox{OH}_0},\VarM{FC})$.
E.g.\ 
\[
P(\Var{\mbox{OH}_1}|\St{2\mbox{cons}},\St{1})=( 
\text{0}_{\St{\mbox{No}}},
\text{0}_{\St{\mbox{1a}}}, \text{0.374}_{\St{\mbox{2cons}}},
\text{0.367}_{\St{\mbox{2s}}}, \text{0.122}_{\St{\mbox{2v}}},
\text{0}_{\St{\mbox{fl}}}, \text{0.163}_{\St{\mbox{st}}},
\text{0}_{\St{\mbox{3v}}}, \text{0}_{\St{\mbox{sf}}})
\]

}

\end{slide}
}
}
{
\begin{slide}{A simplified poker game I}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}

\begin{equation}\nonumber
\hspace*{-0.4cm}P(\Var{\mbox{OH}_0})\approx( 
\text{0.167}_{\St{\mbox{No}}},
\text{0.045}_{\St{\mbox{1a}}}, \text{0.064}_{\St{\mbox{2cons}}},
\text{0.466}_{\St{\mbox{2s}}}, \text{0.169}_{\St{\mbox{2v}}},
\text{0.049}_{\St{\mbox{fl}}}, \text{0.035}_{\St{\mbox{st}}},
\text{0.002}_{\St{\mbox{3v}}}, \text{0.002}_{\St{\mbox{sf}}})
\end{equation}

we have to go into combinatorics:$
\frac{\#\text{good}}{\binom{52}{3}}
$. 
For example,
\[
P(\Var{\mbox{OH}_0}=\St{\mbox{st}})=\frac{54\cdot 4\cdot 4-52}{\binom{52}{3}}.
\]

Similar considerations apply to $P(\Var{\mbox{OH}_1}|\Var{\mbox{OH}_0},\VarM{FC})$.
E.g.\ 
\[
P(\Var{\mbox{OH}_1}|\St{2\mbox{cons}},\St{1})=( 
\text{0}_{\St{\mbox{No}}},
\text{0}_{\St{\mbox{1a}}}, \text{0.374}_{\St{\mbox{2cons}}},
\text{0.367}_{\St{\mbox{2s}}}, \text{0.122}_{\St{\mbox{2v}}},
\text{0}_{\St{\mbox{fl}}}, \text{0.163}_{\St{\mbox{st}}},
\text{0}_{\St{\mbox{3v}}}, \text{0}_{\St{\mbox{sf}}})
\]



\end{slide}

}

%####################################################################################
%# A simplified poker game II
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{A simplified poker game II}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\vspace*{-0.5cm}
\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}
Theoretical considerations are not enough:\\ %
\hspace*{2cm}$P(\VarM{FC}|\Var{\mbox{OH}_0})$ = \Purple{What is my
opponents strategy?}\\
\ \\

Assume the strategy:
\vspace*{-0.5cm}
\begin{equation}\nonumber
\begin{split}
\St{\mbox{no}} & \Green{\rightarrow} \St{3}\\
\St{\mbox{1a}} & \Green{\rightarrow} \St{2} \\
\St{\mbox{2s}}\vee \St{\mbox{2cons}}\vee \St{\mbox{2v}} &
\Green{\rightarrow} \St{1}\\
\St{\mbox{2cons}}\wedge \St{\mbox{2s}} & \Green{\rightarrow} \St{1}\text{\hspace*{1cm} \Purple{(Keep \St{2s})}}\\
\St{\mbox{2cons}}\wedge \St{\mbox{2v}}\vee \St{\mbox{2s}}\wedge
\St{\mbox{2v}} &\Green{\rightarrow} \St{1} \text{ \hspace*{1cm}\Purple{(Keep \St{2v})}}\\
\St{\mbox{fl}}\vee \St{\mbox{st}}\vee \St{\mbox{3v}}\vee \St{\mbox{sf}}&\Green{\rightarrow} \St{0}
\end{split}
\end{equation}
\Purple{
\begin{center}
Note: the states $\St{\mbox{2cons}}\wedge \St{\mbox{2s}}$,
$\St{\mbox{2cons}}\wedge \St{\mbox{2v}}$, $\St{\mbox{2s}}\wedge
\St{\mbox{2v}}$ are redundant.
\end{center}}




}
\fromSlide*{2}{
%\vspace*{-0.4cm}
\Brown{\ul{However}, knowing my system my opponent may ``bluff''.}  
}
\end{slide}
}
}
{
\begin{slide}{A simplified poker game II}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\vspace*{-0.5cm}
\begin{center}
\begin{pspicture}(1,1)(15,6)

\Fnode{2}{5}{oh0}{$\mbox{OH}_0$}
\Fnode{5}{2}{fc}{FC}
\Fnode{8}{5}{oh1}{$\mbox{OH}_1$}
\Fnode{11}{2}{sc}{$\mbox{SC}$}
\Fnode{14}{5}{oh}{$\mbox{OH}$}

\arc{oh0}{fc}
\arc{oh0}{oh1}
\arc{fc}{oh1}
\arc{oh1}{oh}
\arc{oh1}{sc}
\arc{sc}{oh}

%\showgrid
\end{pspicture}
\end{center}
Theoretical considerations are not enough:\\ %
\hspace*{2cm}$P(\VarM{FC}|\Var{\mbox{OH}_0})$ = \Purple{What is my
opponents strategy?}\\
\ \\

Assume the strategy:
\vspace*{-0.5cm}
\begin{equation}\nonumber
\begin{split}
\St{\mbox{no}} & \Green{\rightarrow} \St{3}\\
\St{\mbox{1a}} & \Green{\rightarrow} \St{2} \\
\St{\mbox{2s}}\vee \St{\mbox{2cons}}\vee \St{\mbox{2v}} &
\Green{\rightarrow} \St{1}\\
\St{\mbox{2cons}}\wedge \St{\mbox{2s}} & \Green{\rightarrow} \St{1}\text{\hspace*{1cm} \Purple{(Keep \St{2s})}}\\
\St{\mbox{2cons}}\wedge \St{\mbox{2v}}\vee \St{\mbox{2s}}\wedge
\St{\mbox{2v}} &\Green{\rightarrow} \St{1} \text{ \hspace*{1cm}\Purple{(Keep \St{2v})}}\\
\St{\mbox{fl}}\vee \St{\mbox{st}}\vee \St{\mbox{3v}}\vee \St{\mbox{sf}}&\Green{\rightarrow} \St{0}
\end{split}
\end{equation}
\Purple{
\begin{center}
Note: the states $\St{\mbox{2cons}}\wedge \St{\mbox{2s}}$,
$\St{\mbox{2cons}}\wedge \St{\mbox{2v}}$, $\St{\mbox{2s}}\wedge
\St{\mbox{2v}}$ are redundant.
\end{center}}
%\vspace*{-0.4cm}
\Brown{\ul{However}, knowing my system my opponent may ``bluff''.}  
\end{slide}
}

%####################################################################################
%# Transmission of symbol strings
%####################################################################################

\PDForPS{
\overlays{3}{
\begin{slide}{Transmission of symbol strings}
\fromSlide*{1}{
\begin{minipage}{\linewidth}
A language $L$ over $\{\Purple{a},\Purple{b}\}$  is transmitted
through a channel. Each word is surrounded by $\Purple{c}$. In the
transmission some characters may be corrupted by noise and may be
confused with others.
\end{minipage}

\ \\
A five-letter word has been transmitted.
\ \\
\ \\
}
\onlySlide*{1}{
\ul{\Green{Hypothesis variables:}}   
\ \\
\ \\

\ul{\Green{Information variables:}}
}
\fromSlide*{2}{
\ul{\Green{Hypothesis variables:}} $\Var{T_1}$, $\Var{T_2}$,
$\Var{T_3}$, $\Var{T_4}$, $\Var{T_5}$ (\St{States:} $\St{a},\St{b}$)
\ \\
\ \\

\ul{\Green{Information variables:}} $\Var{R_1}$, $\Var{R_2}$,
$\Var{R_3}$, $\Var{R_4}$, $\Var{R_5}$ (\St{States:}
$\St{a},\St{b},\St{c}$)
}
\onlySlide*{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(23,6)

\Fnode{2}{5}{t1}{$T_1$}
\Fnode{7}{5}{t2}{$T_2$}
\Fnode{12}{5}{t3}{$T_3$}
\Fnode{17}{5}{t4}{$T_4$}
\Fnode{22}{5}{t5}{$T_5$}

\Fnode{2}{1}{r1}{$R_1$}
\Fnode{7}{1}{r2}{$R_2$}
\Fnode{12}{1}{r3}{$R_3$}
\Fnode{17}{1}{r4}{$R_4$}
\Fnode{22}{1}{r5}{$R_5$}

%\showgrid
\end{pspicture}
\end{center}
}
\onlySlide*{3}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(23,6)

\Fnode{2}{5}{t1}{$T_1$}
\Fnode{7}{5}{t2}{$T_2$}
\Fnode{12}{5}{t3}{$T_3$}
\Fnode{17}{5}{t4}{$T_4$}
\Fnode{22}{5}{t5}{$T_5$}

\Fnode{2}{1}{r1}{$R_1$}
\Fnode{7}{1}{r2}{$R_2$}
\Fnode{12}{1}{r3}{$R_3$}
\Fnode{17}{1}{r4}{$R_4$}
\Fnode{22}{1}{r5}{$R_5$}

\arc{t1}{r1}
\arc{t2}{r2}
\arc{t3}{r3}
\arc{t4}{r4}
\arc{t5}{r5}

%\showgrid
\end{pspicture}
\end{center}

$P(\Var{R_i}|\Var{T_i})$ can be determined through statistics:
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,4)

\rput[lb](0,0){
\begin{tabular}{cc|ccc}
& & \multicolumn{3}{c}{$\Var{R_i}$} \\
& &  $\Var{R_i}=\St{a}$ & $\Var{R_i}=\St{b}$  & $\Var{R_i}=\St{c}$ \\ \hline
\multirow{2}{0.cm}{$\Var{T_i}$} & $\St{a}$ & $0.8$ & $0.1$ & $0.1$ \\
  & $\St{b}$ & $0.15$ & $0.8$ & $0.05$ 
\end{tabular}
}

\rput[l](16,2){Are the $\Var{T_i}$'s independent?}
%\showgrid
\end{pspicture}
\end{center}


}

\end{slide}
}
}
{
\begin{slide}{Transmission of symbol strings}

A language $L$ over $\{\Purple{a},\Purple{b}\}$  is transmitted
through a channel. Each word is surrounded by $\Purple{c}$. In the
transmission some characters may be corrupted by noise and may be
confused with others.
\ \\
A five-letter word has been transmitted.
\ \\
\ \\
\ul{\Green{Hypothesis variables:}} $\Var{T_1}$, $\Var{T_2}$,
$\Var{T_3}$, $\Var{T_4}$, $\Var{T_5}$ (\St{States:} $\St{a},\St{b}$)
\ \\
\ \\

\ul{\Green{Information variables:}} $\Var{R_1}$, $\Var{R_2}$,
$\Var{R_3}$, $\Var{R_4}$, $\Var{R_5}$ (\St{States:}
$\St{a},\St{b},\St{c}$)

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(23,6)

\Fnode{2}{5}{t1}{$T_1$}
\Fnode{7}{5}{t2}{$T_2$}
\Fnode{12}{5}{t3}{$T_3$}
\Fnode{17}{5}{t4}{$T_4$}
\Fnode{22}{5}{t5}{$T_5$}

\Fnode{2}{1}{r1}{$R_1$}
\Fnode{7}{1}{r2}{$R_2$}
\Fnode{12}{1}{r3}{$R_3$}
\Fnode{17}{1}{r4}{$R_4$}
\Fnode{22}{1}{r5}{$R_5$}

\arc{t1}{r1}
\arc{t2}{r2}
\arc{t3}{r3}
\arc{t4}{r4}
\arc{t5}{r5}

%\showgrid
\end{pspicture}
\end{center}

$P(\Var{R_i}|\Var{T_i})$ can be determined through statistics:
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(28,4)

\rput[lb](0,0){
\begin{tabular}{cc|ccc}
& & \multicolumn{3}{c}{$\Var{R_i}$} \\
& &  $\Var{R_i}=\St{a}$ & $\Var{R_i}=\St{b}$  & $\Var{R_i}=\St{c}$ \\ \hline
\multirow{2}{0.cm}{$\Var{T_i}$} & $\St{a}$ & $0.8$ & $0.1$ & $0.1$ \\
  & $\St{b}$ & $0.15$ & $0.8$ & $0.05$ 
\end{tabular}
}

\rput[l](16,2){Are the $\Var{T_i}$'s independent?}
%\showgrid
\end{pspicture}
\end{center}
\end{slide}



}

%####################################################################################
%# Transmission of symbol strings: Simple dependence model
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Transmission of symbol strings}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(19,7)

\Fnode{2}{6}{i1}{$T_1$}
\Fnode{2}{2}{t1}{$R_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$T_2$}
\Fnode{6}{2}{t2}{$R_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$T_3$}
\Fnode{10}{2}{t3}{$R_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$T_4$}
\Fnode{14}{2}{t4}{$R_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$T_5$}
\Fnode{18}{2}{t5}{$R_5$}
\arc{i5}{t5}


\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}


%\showgrid
\end{pspicture}
\end{center}

\ul{To find $P(\Var{T_{i+1}}|\Var{T_i})$:} Look at the permitted words and
their frequencies.

\begin{center}
\begin{tabular}{cc|cccccccc}
& & \multicolumn{8}{c}{Last 3} \\
& &  $\St{aaa}$ & $\St{aab}$  & $\St{aba}$ & $\St{abb}$ & $\St{baa}$ &
$\St{bab}$ & $\St{bba}$ & $\St{bbb}$    \\ \hline
\multirow{4}{0cm}{\begin{rotate}{90}\hspace*{-0.3cm}First 2\end{rotate}} 
& $\St{aa}$ & $0.017$ & $0.021$ & $0.019$ & $0.019$ & $0.045$ & $0.068$ & $0.045$ & $0.068$  \\
& $\St{ab}$ & $0.033$ & $0.040$ & $0.037$ & $0.038$ & $0.011$ & $0.016$ & $0.010$ & $0.015$  \\
& $\St{ba}$ & $0.011$ & $0.014$ & $0.010$ & $0.010$ & $0.031$ & $0.046$ & $0.031$ & $0.045$  \\
& $\St{bb}$ & $0.050$ & $0.060$ & $0.057$ & $0.057$ & $0.016$ & $0.023$ & $0.015$ & $0.023$  \\
\end{tabular}
\end{center}
}
\fromSlide*{2}{
\ \\
\ \\

\begin{equation}\nonumber
P(\Var{T_2}=\St{a}|\Var{T_1}=\St{a})=\frac{P(\Var{T_2}=\St{a},\Var{T_1}=\St{a})}{P(\Var{T_1}=\St{a})}
= \frac{0.017 + 0.021+\cdots + 0.068}{0.017+\cdots +0.068+0.033+\cdots 0.015}=0.6
\end{equation}

}


\end{slide}
}
}
{
\begin{slide}{Transmission of symbol strings}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,1)(19,7)

\Fnode{2}{6}{i1}{$T_1$}
\Fnode{2}{2}{t1}{$R_1$}
\arc{i1}{t1}

\Fnode{6}{6}{i2}{$T_2$}
\Fnode{6}{2}{t2}{$R_2$}
\arc{i2}{t2}

\Fnode{10}{6}{i3}{$T_3$}
\Fnode{10}{2}{t3}{$R_3$}
\arc{i3}{t3}

\Fnode{14}{6}{i4}{$T_4$}
\Fnode{14}{2}{t4}{$R_4$}
\arc{i4}{t4}

\Fnode{18}{6}{i5}{$T_5$}
\Fnode{18}{2}{t5}{$R_5$}
\arc{i5}{t5}


\arc{i1}{i2}
\arc{i2}{i3}
\arc{i3}{i4}
\arc{i4}{i5}


%\showgrid
\end{pspicture}
\end{center}

\ul{To find $P(\Var{T_{i+1}}|\Var{T_i})$:} Look at the permitted words and
their frequencies.

\begin{center}
\begin{tabular}{cc|cccccccc}
& & \multicolumn{8}{c}{Last 3} \\
& &  $\St{aaa}$ & $\St{aab}$  & $\St{aba}$ & $\St{abb}$ & $\St{baa}$ &
$\St{bab}$ & $\St{bba}$ & $\St{bbb}$    \\ \hline
\multirow{4}{0cm}{\begin{rotate}{90}\hspace*{-0.3cm}First 2\end{rotate}} 
& $\St{aa}$ & $0.017$ & $0.021$ & $0.019$ & $0.019$ & $0.045$ & $0.068$ & $0.045$ & $0.068$  \\
& $\St{ab}$ & $0.033$ & $0.040$ & $0.037$ & $0.038$ & $0.011$ & $0.016$ & $0.010$ & $0.015$  \\
& $\St{ba}$ & $0.011$ & $0.014$ & $0.010$ & $0.010$ & $0.031$ & $0.046$ & $0.031$ & $0.045$  \\
& $\St{bb}$ & $0.050$ & $0.060$ & $0.057$ & $0.057$ & $0.016$ & $0.023$ & $0.015$ & $0.023$  \\
\end{tabular}
\end{center}

\begin{equation}\nonumber
P(\Var{T_2}=\St{a}|\Var{T_1}=\St{a})=\frac{P(\Var{T_2}=\St{a},\Var{T_1}=\St{a})}{P(\Var{T_1}=\St{a})}
= \frac{0.017 + 0.021+\cdots + 0.068}{0.017+\cdots +0.068+0.033+\cdots 0.015}=0.6
\end{equation}
\end{slide}

}

%####################################################################################
%# Cold or angina? I
%####################################################################################


\begin{slide}{Cold or angina? I}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}

\ul{\Purple{Subjective estimates:}}
\begin{equation}\nonumber
\begin{split}
&P(\VarM{Cold?})=(0.97,0.03)\\
&P(\VarM{Angina?})=(0.993,0.005,0.002)
\end{split}
\end{equation}

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{See spots?}$} & \St{no} & $1$ & $1$ & $0.1$
 \\
& \St{yes} & $0$ & $0$ & $0.9$\\
\multicolumn{5}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{center}

\centerline{
\Red{But how do we find e.g.\ \Black{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}?} 
}

\end{slide}


%####################################################################################
%# Cold or angina? II
%####################################################################################

\begin{slide}{Cold or angina? II}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}

\begin{itemize}
\item If neither \Var{Cold?} nor \Var{Angina?}, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=0.05$.
\item If only \Var{Cold?}, then $P(\VarM{Sore throat?}=\St{\mbox{y}})=0.4$.
\item If only $\VarM{Angina?}=\St{\mbox{mild}}$, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=0.7$.
\item If $\VarM{Angina?}=\St{\mbox{severe}}$, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=1$.
\end{itemize}

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{y}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}



\end{slide}

%####################################################################################
%# Cold or angina? III
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Cold or angina? III}
\fromSlide*{1}{
We have the partial specification:

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{yes}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}
\ \\
\ \\
\ \\
\ \\

In order to find $P(\VarM{Sore
throat}=\St{\mbox{yes}}|\VarM{Cold?}=\St{\mbox{yes}},
\VarM{Angina?}=\St{\mbox{mild}})$ assume that:
\ \\
\ \\
Out of $100$ mornings, I have a ``background'' sore
throat on $5$ of them.
\begin{itemize}
\item \Purple{$95$ left}: $40\%$ ``\Purple{cold-sore}'' = $38$ 
\item \Purple{$57$ left}: $70\%$ ``\Purple{mild angina-sore}'' = $39.9$ 
\end{itemize}
\Green{In total:} $5+38+39.9=82.9\rightarrow 85$.


}
\fromSlide*{2}{
\hspace*{6cm}\vspace*{-2cm}\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{$0.85$} & $1$
\end{tabular}
}
\end{slide}
}
}
{
\begin{slide}{Cold or angina? III}
We have the partial specification:

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{yes}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}
\ \\
\ \\
\ \\
\ \\

In order to find $P(\VarM{Sore
throat}=\St{\mbox{yes}}|\VarM{Cold?}=\St{\mbox{yes}},
\VarM{Angina?}=\St{\mbox{mild}})$ assume that:
\ \\
\ \\
Out of $100$ mornings, I have a ``background'' sore
throat on $5$ of them.
\begin{itemize}
\item \Purple{$95$ left}: $40\%$ ``\Purple{cold-sore}'' = $38$ 
\item \Purple{$57$ left}: $70\%$ ``\Purple{mild angina-sore}'' = $39.9$ 
\end{itemize}
\Green{In total:} $5+38+39.9=82.9\rightarrow 85$.

\hspace*{6cm}\vspace*{-2cm}\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{$0.85$} & $1$
\end{tabular}

\end{slide}
}



%####################################################################################
%# Cold or angina? I
%####################################################################################


\begin{slide}{Cold or angina? I}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}

\ul{\Purple{Subjective estimates:}}
\begin{equation}\nonumber
\begin{split}
&P(\VarM{Cold?})=(0.97,0.03)\\
&P(\VarM{Angina?})=(0.993,0.005,0.002)
\end{split}
\end{equation}

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{See spots?}$} & \St{no} & $1$ & $1$ & $0.1$
 \\
& \St{yes} & $0$ & $0$ & $0.9$\\
\multicolumn{5}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{center}

\centerline{
\Red{But how do we find e.g.\ \Black{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}?} 
}

\end{slide}


%####################################################################################
%# Cold or angina? II
%####################################################################################

\begin{slide}{Cold or angina? II}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}

\begin{itemize}
\item If neither \Var{Cold?} nor \Var{Angina?}, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=0.05$.
\item If only \Var{Cold?}, then $P(\VarM{Sore throat?}=\St{\mbox{y}})=0.4$.
\item If only $\VarM{Angina?}=\St{\mbox{mild}}$, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=0.7$.
\item If $\VarM{Angina?}=\St{\mbox{severe}}$, then $P(\VarM{Sore
throat?}=\St{\mbox{y}})=1$.
\end{itemize}

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{y}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}



\end{slide}

%####################################################################################
%# Cold or angina? III
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Cold or angina? III}
\fromSlide*{1}{
We have the partial specification:

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{yes}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}
\ \\
\ \\
\ \\
\ \\

In order to find $P(\VarM{Sore
throat}=\St{\mbox{yes}}|\VarM{Cold?}=\St{\mbox{yes}},
\VarM{Angina?}=\St{\mbox{mild}})$ assume that:
\ \\
\ \\
Out of $100$ mornings, I have a ``background'' sore
throat on $5$ of them.
\begin{itemize}
\item \Purple{$95$ left}: $40\%$ ``\Purple{cold-sore}'' = $38$ 
\item \Purple{$57$ left}: $70\%$ ``\Purple{mild angina-sore}'' = $39.9$ 
\end{itemize}
\Green{In total:} $5+38+39.9=82.9\rightarrow 85$.


}
\fromSlide*{2}{
\hspace*{6cm}\vspace*{-2cm}\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{$0.85$} & $1$
\end{tabular}
}
\end{slide}
}
}
{
\begin{slide}{Cold or angina? III}
We have the partial specification:

\begin{center}
\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{??} & $1$\\
\multicolumn{5}{c}{$P(\VarM{Sore throat?}=\St{\mbox{yes}}|\VarM{Cold?},\VarM{Angina?})$}
\end{tabular}
\end{center}
\ \\
\ \\
\ \\
\ \\

In order to find $P(\VarM{Sore
throat}=\St{\mbox{yes}}|\VarM{Cold?}=\St{\mbox{yes}},
\VarM{Angina?}=\St{\mbox{mild}})$ assume that:
\ \\
\ \\
Out of $100$ mornings, I have a ``background'' sore
throat on $5$ of them.
\begin{itemize}
\item \Purple{$95$ left}: $40\%$ ``\Purple{cold-sore}'' = $38$ 
\item \Purple{$57$ left}: $70\%$ ``\Purple{mild angina-sore}'' = $39.9$ 
\end{itemize}
\Green{In total:} $5+38+39.9=82.9\rightarrow 85$.

\hspace*{6cm}\vspace*{-2cm}\begin{tabular}{cc|cccc}
 & & \multicolumn{3}{c}{$\VarM{Angina?}$}\\
 & & \St{no} & \St{mild} & \St{severe} \\\hline
\multirow{2}{1.2cm}{$\VarM{Cold?}$} & \St{no} & $0.05$ & $0.7$ & $1$
 \\
& \St{yes} & $0.4$ & \Purple{$0.85$} & $1$
\end{tabular}

\end{slide}
}




%####################################################################################
%# Several independent causes, in general
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Several independent causes, in general}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,1)(26,6)

\Fovalnode[0.6cm]{3}{5}{c1}{$\mbox{Cause}_1$}
\Fovalnode[0.6cm]{3}{2}{cn}{$\mbox{Cause}_n$}
\Fovalnode[0.6cm]{8}{3.5}{e}{$\mbox{Effect}$}

\psline[linestyle=dotted,linecolor=blue](3,4)(3,3)
\arc{c1}{e}
\arc{cn}{e}

\rput[l](10,5){$\Var{\mbox{Cause}_i}$ results in \Var{Effect} with}
\rput[l](11,4){probability $x_i$.}
\rput[l](10,2){$P(\VarM{Effect}=\StM{yes}|\VarM{Combination of causes})$ = ??}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\
}
\fromSlide*{2}{
\ul{\Purple{Way to look at it:}} $\Var{\mbox{Cause}_i}$ results in
\Var{Effect} unless it is inhibited by ``something''.\newline
\phantom{\ul{\Purple{Way to look at it:}}} The \Var{Inhibitor} has
probability $q_i=1-x_i$.
\ \\
\ \\
\ \\

\ul{\Purple{Assumption:}} The \Var{Inhibitors} are
independent. \newline
\phantom{\ul{\Purple{Assumption:}}} That is, the probability of
``$\Var{\mbox{Inh}_i}$ \ul{and} $\Var{\mbox{Inh}_j}$'' = $q_iq_j$. 
\ \\
\ \\

\ul{\Purple{Thus}},
\begin{equation}\nonumber
P(\VarM{Effect}=\StM{yes}|\Var{\mbox{Cause}_i},\Var{\mbox{Cause}_j},\Var{\mbox{Cause}_k})=1-q_iq_jq_k
\end{equation}


}
\end{slide}}
}
{
\begin{slide}{Several independent causes, in general}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,1)(26,6)

\Fovalnode[0.6cm]{3}{5}{c1}{$\mbox{Cause}_1$}
\Fovalnode[0.6cm]{3}{2}{cn}{$\mbox{Cause}_n$}
\Fovalnode[0.6cm]{8}{3.5}{e}{$\mbox{Effect}$}

\psline[linestyle=dotted,linecolor=blue](3,4)(3,3)
\arc{c1}{e}
\arc{cn}{e}

\rput[l](10,5){$\Var{\mbox{Cause}_i}$ results in \Var{Effect} with}
\rput[l](11,4){probability $x_i$.}
\rput[l](10,2){$P(\VarM{Effect}=\StM{yes}|\VarM{Combination of causes})$ = ??}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\
\ul{\Purple{Way to look at it:}} $\Var{\mbox{Cause}_i}$ results in
\Var{Effect} unless it is inhibited by ``something''.\newline
\phantom{\ul{\Purple{Way to look at it:}}} The \Var{Inhibitor} has
probability $q_i=1-x_i$.
\ \\
\ \\
\ \\

\ul{\Purple{Assumption:}} The \Var{Inhibitors} are
independent. \newline
\phantom{\ul{\Purple{Assumption:}}} That is, the probability of
``$\Var{\mbox{Inh}_i}$ \ul{and} $\Var{\mbox{Inh}_j}$'' = $q_iq_j$. 
\ \\
\ \\

\ul{\Purple{Thus}},
\begin{equation}\nonumber
P(\VarM{Effect}=\StM{yes}|\Var{\mbox{Cause}_i},\Var{\mbox{Cause}_j},\Var{\mbox{Cause}_k})=1-q_iq_jq_k
\end{equation}
\end{slide}

}

%####################################################################################
%# Noisy or
%####################################################################################


\begin{slide}{Noisy or}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,1)(26,6)

\Fnode[0.25cm]{3}{5}{a1}{$A_1$}
\Fnode[0.25cm]{3}{2}{an}{$A_n$}
\Fnode[0.25cm]{7}{3.5}{t}{$B$}

\psline[linestyle=dotted,linecolor=blue](3,4)(3,3)
\arc{a1}{t}
\arc{an}{t}

\rput[l](10,4.5){All nodes are binary.}
\rput[l](10,2.5){All causes for $\Var{B}$ are listed explicitly.}

\rput[l](4.5,4.7){$1-q_1$}
\rput[l](4.5,2.2){$1-q_n$}

%\showgrid
\end{pspicture}
\end{center}
\ \\
\ \\

\ul{\Purple{In general:}}
\begin{equation}\nonumber
P(\Var{B}=\St{y}|\Var{A_{i_1}}=\cdots =\Var{A_{i_k}}=\St{y},\VarM{the
rest}=\St{n}) = 1-q_{i_1}\cdots q_{i_k}
\end{equation}

\ul{\Purple{If only $\Var{A_1}$ and $\Var{A_2}$ are on:}}
\begin{equation}\nonumber
P(\Var{B}=\St{y}|\Var{A_{1}}=\St{y},\Var{A_{2}}=\St{y},\VarM{the
rest}=\St{n}) = 1-q_{1} q_{2}
\end{equation}

\ul{\Purple{Note:}} If $P(\Var{B}=\St{y}|\VarM{All}=\St{n})=x>0$, then
introduce a background cause $\Var{C}$ which is always\newline
\phantom{\ul{\Purple{Note:}}} on, and $q_c=1-x$.

\end{slide}


%####################################################################################
%# Divorcing
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Divorcing}
\fromSlide*{1}{
\begin{center}
\begin{tabular}{ccc}
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\Fcircle{$A_1$}
	\Fcircle{$A_2$}
	\Fcircle{$A_3$}
	\Fcircle{$A_4$}
}
}
&
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\pstree{\Fcircle{$C_1$}}
	{
		\Fcircle{$A_1$}
		\Fcircle{$A_2$}
	}
	\Fcircle{$A_3$}
	\Fcircle{$A_4$}
}
}
&
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\pstree{\Fcircle{$C_1$}}
	{
		\Fcircle{$A_1$}
		\Fcircle{$A_2$}
	}
	\pstree{\Fcircle{$C_2$}}
	{
		\Fcircle{$A_3$}
		\Fcircle{$A_4$}
	}
}
}
\\
$3^{5}=243$ & $3^4+3^3=108$ & $3\cdot 3^3=81$ 
\end{tabular}
\end{center}

\centerline{
\Purple{Can this always be done?}
}


}
\fromSlide*{2}{
\ \\
\ \\
\psset{levelsep=1.5cm}
\begin{center}
\mbox{
\pstree[treemode=U,arrows=<-,linecolor=green]{\Foval[1cm]{Buy?}}
{
	\Foval[1cm]{Price}
	\Foval[1cm]{Condition}
	\Foval[1cm]{Size}
	\Foval[1cm]{Age}
	\Foval[1cm]{Brand}
}
}
\end{center}

}
\end{slide}
}
}
{
\begin{slide}{Divorcing}

\begin{center}
\begin{tabular}{ccc}
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\Fcircle{$A_1$}
	\Fcircle{$A_2$}
	\Fcircle{$A_3$}
	\Fcircle{$A_4$}
}
}
&
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\pstree{\Fcircle{$C_1$}}
	{
		\Fcircle{$A_1$}
		\Fcircle{$A_2$}
	}
	\Fcircle{$A_3$}
	\Fcircle{$A_4$}
}
}
&
\mbox{
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$B$}}
{
	\pstree{\Fcircle{$C_1$}}
	{
		\Fcircle{$A_1$}
		\Fcircle{$A_2$}
	}
	\pstree{\Fcircle{$C_2$}}
	{
		\Fcircle{$A_3$}
		\Fcircle{$A_4$}
	}
}
}
\\
$3^{5}=243$ & $3^4+3^3=108$ & $3\cdot 3^3=81$ 
\end{tabular}
\end{center}

\centerline{
\Purple{Can this always be done?}
}
\ \\
\ \\
\psset{levelsep=1.5cm}
\begin{center}
\mbox{
\pstree[treemode=U,arrows=<-,linecolor=green]{\Foval[1cm]{Buy?}}
{
	\Foval[1cm]{Price}
	\Foval[1cm]{Condition}
	\Foval[1cm]{Size}
	\Foval[1cm]{Age}
	\Foval[1cm]{Brand}
}
}
\end{center}

\end{slide}

}

%####################################################################################
%# Divorcing: An example
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Divorcing: An example}
\onlySlide*{1}{
\psset{levelsep=2.5cm}
\begin{tabular}{cc}

\multirow{3}{5cm}{
\mbox{%
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$F$}}%
{%
	\Foval[1.2cm]{$A$: $\St{a_1},\St{a_2},\St{a_3}$}%
	\Foval[1.2cm]{$B$: $\St{b_1},\St{b_2},\St{b_3}$}%
	\Foval[1.2cm]{$D$: $\St{d_1},\St{d_2},\St{d_3}$}%
	\Foval[1.2cm]{$E$: $\St{e_1},\St{e_2},\St{e_3}$}%
}%
}%
}
&$P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_1},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_2},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})=P(\Var{F}|\St{a_j},\St{b_3},\Var{D},\Var{E})$
\end{tabular}
}
\onlySlide*{2}{
\psset{levelsep=2.5cm}
\begin{tabular}{cc}

\multirow{3}{6cm}{
\mbox{%
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$F$}}%
{%
	\pstree{\Foval[1.2cm]{$C$: $\St{c_1},\St{c_2},\St{c_3}$}}%
	{
		\Foval[1.2cm]{$A$: $\St{a_1},\St{a_2},\St{a_3}$}%
		\Foval[1.2cm]{$B$: $\St{b_1},\St{b_2},\St{b_3}$}%
	}%
	\Foval[1.2cm]{$D$: $\St{d_1},\St{d_2},\St{d_3}$}%
	\Foval[1.2cm]{$E$: $\St{e_1},\St{e_2},\St{e_3}$}%
}%
}%
}
&$P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_1},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_2},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})=P(\Var{F}|\St{a_j},\St{b_3},\Var{D},\Var{E})$
\end{tabular}
\vspace*{2.4cm}
\begin{equation}\nonumber
\begin{split}
&P(\Purple{C}|\St{a_1},\St{b_2})=P(\Purple{C}|\St{a_2},\St{b_1}) =
(1,0,0)\\
&P(\Purple{C}|\St{a_1},\St{b_1})=P(\Purple{C}|\St{a_2},\St{b_2}) =
(0,1,0)\\
&P(\Purple{C}|\St{a_3},\St{b_i})=P(\Purple{C}|\St{a_j},\St{b_3}) =
(0,0,1)\\
&P(\Var{F}|\Purple{c_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})\\
&P(\Var{F}|\Purple{c_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})\\
&P(\Var{F}|\Purple{c_3},\Var{D},\Var{E})=P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})
\end{split}
\end{equation}
}


\end{slide}}
}
{
\begin{slide}{Divorcing: An example I}
\psset{levelsep=2.5cm}
\begin{tabular}{cc}

\multirow{3}{5cm}{
\mbox{%
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$F$}}%
{%
	\Foval[1.2cm]{$A$: $\St{a_1},\St{a_2},\St{a_3}$}%
	\Foval[1.2cm]{$B$: $\St{b_1},\St{b_2},\St{b_3}$}%
	\Foval[1.2cm]{$D$: $\St{d_1},\St{d_2},\St{d_3}$}%
	\Foval[1.2cm]{$E$: $\St{e_1},\St{e_2},\St{e_3}$}%
}%
}%
}
&$P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_1},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_2},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})=P(\Var{F}|\St{a_j},\St{b_3},\Var{D},\Var{E})$
\end{tabular}

\end{slide}

\begin{slide}{Divorcing: An example II}
\psset{levelsep=2.5cm}
\begin{tabular}{cc}

\multirow{3}{6cm}{
\mbox{%
\pstree[treemode=L,arrows=<-,linecolor=green]{\Fcircle{$F$}}%
{%
	\pstree{\Foval[1.2cm]{$C$: $\St{c_1},\St{c_2},\St{c_3}$}}%
	{
		\Foval[1.2cm]{$A$: $\St{a_1},\St{a_2},\St{a_3}$}%
		\Foval[1.2cm]{$B$: $\St{b_1},\St{b_2},\St{b_3}$}%
	}%
	\Foval[1.2cm]{$D$: $\St{d_1},\St{d_2},\St{d_3}$}%
	\Foval[1.2cm]{$E$: $\St{e_1},\St{e_2},\St{e_3}$}%
}%
}%
}
&$P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_1},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_2},\St{b_2},\Var{D},\Var{E})$\\
&$P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})=P(\Var{F}|\St{a_j},\St{b_3},\Var{D},\Var{E})$
\end{tabular}
\vspace*{2.4cm}
\begin{equation}\nonumber
\begin{split}
&P(\Purple{C}|\St{a_1},\St{b_2})=P(\Purple{C}|\St{a_2},\St{b_1}) =
(1,0,0)\\
&P(\Purple{C}|\St{a_1},\St{b_1})=P(\Purple{C}|\St{a_2},\St{b_2}) =
(0,1,0)\\
&P(\Purple{C}|\St{a_3},\St{b_i})=P(\Purple{C}|\St{a_j},\St{b_3}) =
(0,0,1)\\
&P(\Var{F}|\Purple{c_1},\Var{D},\Var{E})=P(\Var{F}|\St{a_1},\St{b_2},\Var{D},\Var{E})\\
&P(\Var{F}|\Purple{c_2},\Var{D},\Var{E})=P(\Var{F}|\St{a_1},\St{b_1},\Var{D},\Var{E})\\
&P(\Var{F}|\Purple{c_3},\Var{D},\Var{E})=P(\Var{F}|\St{a_3},\St{b_i},\Var{D},\Var{E})
\end{split}
\end{equation}
\end{slide}


}

%####################################################################################
%# Logical constraints
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Logical constraints}

\fromSlide*{1}{
I have washed two pairs of socks, and now it is hard to distinguish
them. Still it is important for me to couple them correctly. The
\Var{color} and \Var{pattern} give indications. 
}
\onlySlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,-1)(30,6)

\Fovalnode[1.1cm]{3.75}{0}{s1}{$\mbox{Sock}_1$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{2}{4}{p1}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{5.5}{4}{c1}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s1}{p1}
\arc{s1}{c1}

\Fovalnode[1.1cm]{11.25}{0}{s2}{$\mbox{Sock}_2$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{9.5}{4}{p2}{\begin{tabular}{c}$P_2$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{13}{4}{c2}{\begin{tabular}{c}$C_2$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s2}{p2}
\arc{s2}{c2}

\Fovalnode[1.1cm]{18.75}{0}{s3}{$\mbox{Sock}_3$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{17}{4}{p3}{\begin{tabular}{c}$P_3$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{20.5}{4}{c3}{\begin{tabular}{c}$C_3$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s3}{p3}
\arc{s3}{c3}

\Fovalnode[1.1cm]{26.25}{0}{s4}{$\mbox{Sock}_4$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{24.5}{4}{p4}{\begin{tabular}{c}$P_4$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{28}{4}{c4}{\begin{tabular}{c}$C_4$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s4}{p4}
\arc{s4}{c4}


%\showgrid
\end{pspicture}
\end{center}
}
\onlySlide*{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,-9)(30,6)

\Fovalnode[1.1cm]{3.75}{0}{s1}{$\mbox{Sock}_1$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{2}{4}{p1}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{5.5}{4}{c1}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s1}{p1}
\arc{s1}{c1}

\Fovalnode[1.1cm]{11.25}{0}{s2}{$\mbox{Sock}_2$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{9.5}{4}{p2}{\begin{tabular}{c}$P_2$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{13}{4}{c2}{\begin{tabular}{c}$C_2$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s2}{p2}
\arc{s2}{c2}

\Fovalnode[1.1cm]{18.75}{0}{s3}{$\mbox{Sock}_3$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{17}{4}{p3}{\begin{tabular}{c}$P_3$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{20.5}{4}{c3}{\begin{tabular}{c}$C_3$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s3}{p3}
\arc{s3}{c3}

\Fovalnode[1.1cm]{26.25}{0}{s4}{$\mbox{Sock}_4$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{24.5}{4}{p4}{\begin{tabular}{c}$P_4$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{28}{4}{c4}{\begin{tabular}{c}$C_4$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s4}{p4}
\arc{s4}{c4}

\Fovalnode[0.9cm]{15.5}{-5}{c}{Const.: \St{y},\St{n}}
\arc{s1}{c}
\arc{s2}{c}
\arc{s3}{c}
\arc{s4}{c}

\rput(6,-6){
\begin{tabular}{cc|cccc}
 & & \multicolumn{4}{c}{$\Var{S_3},\Var{S_4}$}\\
 & & $\St{t_1},\St{t_1}$ & $\St{t_1},\St{t_2}$ & $\St{t_2},\St{t_1}$ &
 $\St{t_2},\St{t_2}$ \\ \hline
\multirow{4}{0cm}{\vspace*{-0.5cm}\begin{rotate}{90}$\Var{S_1},\Var{S_2}$\end{rotate}}
 & $\St{t_1},\St{t_1}$ & $0$ & $0$ & $0$ &  $1$\\
& $\St{t_1},\St{t_2}$ & $0$ & $1$ & $1$ & $0$ \\
& $\St{t_2},\St{t_1}$ & $0$ & $1$ & $1$ & $0$\\
& $\St{t_2},\St{t_2}$ & $1$ & $0$ & $0$ & $0$
\end{tabular}


}

\rput[l](13,-7.5){$P(\VarM{Const.}=\St{\mbox{y}}|\Var{\mbox{Sock}_1},\ldots ,\Var{\mbox{Sock}_4})$}
\rput(20,-5){\rnode[l]{t}{\St{y}}}
\ncline[linecolor=red,linestyle=dotted]{->}{t}{c}


%\showgrid
\end{pspicture}
\end{center}
}

\end{slide}
}
}
{
\begin{slide}{Logical constraints}

I have washed two pairs of socks, and now it is hard to distinguish
them. Still it is important for me to couple them correctly. The
\Var{color} and \Var{pattern} give indications. 
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,-9)(30,6)

\Fovalnode[1.1cm]{3.75}{0}{s1}{$\mbox{Sock}_1$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{2}{4}{p1}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{5.5}{4}{c1}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s1}{p1}
\arc{s1}{c1}

\Fovalnode[1.1cm]{11.25}{0}{s2}{$\mbox{Sock}_2$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{9.5}{4}{p2}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{13}{4}{c2}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s2}{p2}
\arc{s2}{c2}

\Fovalnode[1.1cm]{18.75}{0}{s3}{$\mbox{Sock}_3$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{17}{4}{p3}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{20.5}{4}{c3}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s3}{p3}
\arc{s3}{c3}

\Fovalnode[1.1cm]{26.25}{0}{s4}{$\mbox{Sock}_4$: $\St{t_1},\St{t_2}$}
\Fnode[0.3cm]{24.5}{4}{p4}{\begin{tabular}{c}$P_1$:\\
$\St{p_1},\St{p_2}$\end{tabular}}
\Fnode[0.3cm]{28}{4}{c4}{\begin{tabular}{c}$C_1$:\\
$\St{c_1},\St{c_2}$\end{tabular}}

\arc{s4}{p4}
\arc{s4}{c4}

\Fovalnode[0.9cm]{15.5}{-5}{c}{Const.: \St{y},\St{n}}
\arc{s1}{c}
\arc{s2}{c}
\arc{s3}{c}
\arc{s4}{c}

\rput(6,-6){
\begin{tabular}{cc|cccc}
 & & \multicolumn{4}{c}{$\Var{S_3},\Var{S_4}$}\\
 & & $\St{t_1},\St{t_1}$ & $\St{t_1},\St{t_2}$ & $\St{t_2},\St{t_1}$ &
 $\St{t_2},\St{t_2}$ \\ \hline
\multirow{4}{0cm}{\vspace*{-0.5cm}\begin{rotate}{90}$\Var{S_1},\Var{S_2}$\end{rotate}}
 & $\St{t_1},\St{t_1}$ & $0$ & $0$ & $0$ &  $1$\\
& $\St{t_1},\St{t_2}$ & $0$ & $1$ & $1$ & $0$ \\
& $\St{t_2},\St{t_1}$ & $0$ & $1$ & $1$ & $0$\\
& $\St{t_2},\St{t_2}$ & $1$ & $0$ & $0$ & $0$
\end{tabular}


}

\rput[l](13,-7.5){$P(\VarM{Const.}=\St{\mbox{y}}|\Var{\mbox{Sock}_1},\ldots ,\Var{\mbox{Sock}_4})$}
\rput(20,-5){\rnode[l]{t}{\St{y}}}
\ncline[linecolor=red,linestyle=dotted]{->}{t}{c}


%\showgrid
\end{pspicture}
\end{center}
\end{slide}


}



%####################################################################################
%# Expert disagreement
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Expert disagreement}

\onlySlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(31,7)
\Fnode{2}{6}{a}{$A$}
\Fnode{6}{6}{c}{$C$}
\Fnode{6}{1}{b}{$B$}
\Fnode{8}{3.5}{d}{$D$}

\arc{a}{c}
\arc{c}{d}
\arc{b}{d}

\rput[l](8,7){There are three experts:}

\rput[l](8,4){
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.7$ \\
 & \St{n} & $0.6$ & $0.9$ \\
\multicolumn{4}{c}{$P_1(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&  
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.9$ \\
 & \St{n} & $0.4$ & $0.7$ \\
\multicolumn{4}{c}{$P_2(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.6$ & $0.7$ \\
 & \St{n} & $0.5$ & $0.9$ \\
\multicolumn{4}{c}{$P_3(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
\end{tabular}
}
%\showgrid
\end{pspicture}
\end{center}
\centerline{
I believe twice as much in $P_3$ as I do in the others!
}
}
\onlySlide*{2}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(31,7)
\Fnode{2}{6}{a}{$A$}
\Fnode{6}{6}{c}{$C$}
\Fnode{6}{1}{b}{$B$}
\Fnode{8}{3.5}{d}{$D$}
\Fnode{4}{3.5}{s}{$S$}

\arc{a}{c}
\arc{c}{d}
\arc{b}{d}
\arc{s}{d}

\rput[l](8,7){There are three experts:}

\rput[l](8,4){
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.7$ \\
 & \St{n} & $0.6$ & $0.9$ \\
\multicolumn{4}{c}{$P_1(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&  
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.9$ \\
 & \St{n} & $0.4$ & $0.7$ \\
\multicolumn{4}{c}{$P_2(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.6$ & $0.7$ \\
 & \St{n} & $0.5$ & $0.9$ \\
\multicolumn{4}{c}{$P_3(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
\end{tabular}
}
%\showgrid
\end{pspicture}
\end{center}
\centerline{
I believe twice as much in $P_3$ as I do in the others!
}

\ \\
\ \\
Encode the confidence in $P(\Var{S})$:
\begin{equation}\nonumber
P(\Var{S})=(0.25,0.25,0.5)
\end{equation}
hence,
\vspace*{-0.5cm}
\begin{center}
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $(0.4,0.4,0.6)$ & $(0.7,0.9,0.7)$ \\
 & \St{n} & $(0.6,0.4,0.5)$ & $(0.9,0.7,0.9)$ \\
\multicolumn{4}{c}{$P(\Var{D}=\St{y}|\Var{B},\Var{C},\Var{S})$}
\end{tabular}
\end{center}
}
\end{slide}}
}
{
\begin{slide}{Expert disagreement}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(1,0)(31,7)
\Fnode{2}{6}{a}{$A$}
\Fnode{6}{6}{c}{$C$}
\Fnode{6}{1}{b}{$B$}
\Fnode{8}{3.5}{d}{$D$}
\Fnode{4}{3.5}{s}{$S$}

\arc{a}{c}
\arc{c}{d}
\arc{b}{d}
\arc{s}{d}

\rput[l](8,7){There are three experts:}

\rput[l](8,4){
\begin{tabular}{ccc}
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.7$ \\
 & \St{n} & $0.6$ & $0.9$ \\
\multicolumn{4}{c}{$P_1(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&  
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.4$ & $0.9$ \\
 & \St{n} & $0.4$ & $0.7$ \\
\multicolumn{4}{c}{$P_2(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
&
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $0.6$ & $0.7$ \\
 & \St{n} & $0.5$ & $0.9$ \\
\multicolumn{4}{c}{$P_3(\Var{D}=\St{y}|\Var{B},\Var{C})$}
\end{tabular}
\end{tabular}
}
%\showgrid
\end{pspicture}
\end{center}
\centerline{
I believe twice as much in $P_3$ as I do in the others!
}

\ \\
\ \\
Encode the confidence in $P(\Var{S})$:
\begin{equation}\nonumber
P(\Var{S})=(0.25,0.25,0.5)
\end{equation}
hence,
\vspace*{-0.5cm}
\begin{center}
\begin{tabular}{cc|cc}
 & & \multicolumn{2}{c}{$\Var{B}$} \\
 & & \St{y} & \St{n} \\ \hline
\multirow{2}{0cm}{$\Var{C}$} & \St{y} & $(0.4,0.4,0.6)$ & $(0.7,0.9,0.7)$ \\
 & \St{n} & $(0.6,0.4,0.5)$ & $(0.9,0.7,0.9)$ \\
\multicolumn{4}{c}{$P(\Var{D}=\St{y}|\Var{B},\Var{C},\Var{S})$}
\end{tabular}
\end{center}
\end{slide}
}





%####################################################################################
%# Interventions
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Interventions}
\onlySlide*{1}{

\ul{\Green{Clean the spark plugs:}}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\begin{center}
\begin{pspicture}(0,0)(10,4)

\Fovalnode{2}{2}{fu}{Fuel}
\Fovalnode{7}{2}{sp}{SP}
\Fovalnode{4.5}{-1}{s}{St?}
\Fovalnode{-0.5}{-1}{fm}{FM}


\arc{fu}{fm}
\arc{fu}{s}
\arc{sp}{s}



%\showgrid
\end{pspicture}
\end{center}

}
\onlySlide*{2}{

\ul{\Green{Clean the spark plugs:}}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\begin{center}
\begin{pspicture}(0,0)(10,4)

\Fovalnode{2}{2}{fu}{Fuel}
\Fovalnode{7}{2}{sp}{SP}
\Fovalnode{4.5}{-1}{s}{St?}
\Fovalnode{-0.5}{-1}{fm}{FM}
\Fovalnode{9.5}{-1}{spc}{SP-C}
\Fovalnode{7}{-4}{sc}{St-C?}
\Fbox[0.6cm]{12}{2}{c}{Clean}


\arc{fu}{fm}
\arc{fu}{s}
\arc{sp}{s}

\arc{sp}{spc}
\arc{sp}{sc}
\arc{s}{sc}
\arc{c}{spc}
\arc{spc}{sc}


%\showgrid
\end{pspicture}
\end{center}


}
\end{slide}}
}
{

\begin{slide}{Interventions I}

\ul{\Green{Clean the spark plugs:}}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\begin{center}
\begin{pspicture}(0,0)(10,4)

\Fovalnode{2}{2}{fu}{Fuel}
\Fovalnode{7}{2}{sp}{SP}
\Fovalnode{4.5}{-1}{s}{St?}
\Fovalnode{-0.5}{-1}{fm}{FM}


\arc{fu}{fm}
\arc{fu}{s}
\arc{sp}{s}



%\showgrid
\end{pspicture}
\end{center}
\end{slide}

\begin{slide}{Interventions II}

\ul{\Green{Clean the spark plugs:}}
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}
\begin{center}
\begin{pspicture}(0,0)(10,4)

\Fovalnode{2}{2}{fu}{Fuel}
\Fovalnode{7}{2}{sp}{SP}
\Fovalnode{4.5}{-1}{s}{St?}
\Fovalnode{-0.5}{-1}{fm}{FM}
\Fovalnode{9.5}{-1}{spc}{SP-C}
\Fovalnode{7}{-4}{sc}{St-C?}
\Fbox[0.6cm]{12}{2}{c}{Clean}


\arc{fu}{fm}
\arc{fu}{s}
\arc{sp}{s}

\arc{sp}{spc}
\arc{sp}{sc}
\arc{s}{sc}
\arc{c}{spc}
\arc{spc}{sc}


%\showgrid
\end{pspicture}
\end{center}


\end{slide}

}




%####################################################################################
%# Joint probabilities I
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Joint probabilities I}
\fromSlide*{1}{
\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}
\ \\

It is not unusual to suffer from both cold and angina, so we look for the joint probability:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})
\]
}
\fromSlide*{2}{

From the \Green{fundamental rule} we have:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}}) = P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})P(\VarM{Cold?}|\St{\bar{e}})
\]
\ul{The probability:}
\begin{itemize}
\item $P(\VarM{Cold?}|\St{\bar{e}})$ can be found by propagating $\St{\bar{e}}$.
\item $P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})$ can be found from
  $P(\VarM{Angina?}|\VarM{Cold?}=\StM{yes},\St{\bar{e}})$ and $P(\VarM{Angina?}|\VarM{Cold?}=\StM{no},\St{\bar{e}})$.
\end{itemize}

}

\end{slide}
}
}
{
\begin{slide}{Joint probabilities I}

\psset{unit=0.4cm}
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\begin{center}
\begin{pspicture}(0,0)(23,6)

\rput(3,1){\ovalnode{f}{Fever?}}
\rput(11,1){\ovalnode{st}{Sore Throat?}}
\rput(20,1){\ovalnode{ss}{See spots?}}
\rput(6.5,5){\ovalnode{c}{Cold?}}
\rput(15.5,5){\ovalnode{a}{Angina?}}

\arc{c}{f}
\arc{c}{st}
\arc{a}{st}
\arc{a}{ss}
\arc{a}{f}


%\showgrid
\end{pspicture}
\end{center}
\ \\

It is not unusual to suffer from both cold and angina, so we look for the joint probability:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})
\]


From the \Green{fundamental rule} we have:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}}) = P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})P(\VarM{Cold?}|\St{\bar{e}})
\]
\ul{The probability:}
\begin{itemize}
\item $P(\VarM{Cold?}|\St{\bar{e}})$ can be found by propagating $\St{\bar{e}}$.
\item $P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})$ can be found from
  $P(\VarM{Angina?}|\VarM{Cold?}=\StM{yes},\St{\bar{e}})$ and $P(\VarM{Angina?}|\VarM{Cold?}=\StM{no},\St{\bar{e}})$.
\end{itemize}



\end{slide}

}


%####################################################################################
%# Joint probabilities II
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Joint probabilities II}

\onlySlide*{1}{
From the \Green{fundamental rule} we have:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}}) = P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})P(\VarM{Cold?}|\St{\bar{e}})
\]
\ul{Assume that:}\newline
\hspace*{0.5cm}$\St{e}=(\VarM{Fever?}=\StM{no},\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})$.\newline\newline

\ul{We can calculate:} $P(\VarM{Cold?}|\St{\bar{e}})=(\hspace*{1.5cm},\hspace*{1.5cm})$\newline

\ul{As well as:}
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{yes},\St{\bar{e}})=(\hspace*{1.5cm},\hspace*{1.5cm},\hspace*{1.5cm})$
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{no},\St{\bar{e}})=(\hspace*{1.5cm},\hspace*{1.5cm},\hspace*{1.5cm})$
\end{itemize}
\ \\ \ \\ 

\ul{We can now calculate $P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})$:}
\begin{center}
\begin{tabular}{cc|ccc}
 & & \multicolumn{3}{c}{\Var{Angina?}} \\ 
 & & \St{no} & \St{mild} & \St{severe} \\ \hline
\multirow{2}{0.5cm}{\Var{Cold?}} & \St{no} & \hspace*{1.5cm}  &
 \hspace*{1.5cm} & \hspace*{1.5cm} \\  
& \St{yes} & & & \\ \hline
\end{tabular}
\end{center}

}
\onlySlide*{2}{
From the \Green{fundamental rule} we have:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}}) = P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})P(\VarM{Cold?}|\St{\bar{e}})
\]
\ul{Assume that:}\newline
\hspace*{0.5cm}$\St{e}=(\VarM{Fever?}=\StM{no},\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})$.\newline\newline

\ul{We can calculate:} $P(\VarM{Cold?}|\St{\bar{e}})=(0.997(n),0.003(y))$\newline

\ul{As well as:}
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{yes},\St{\bar{e}})=(0(n),1(m),0(s))$
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{no},\St{\bar{e}})=(0(n),0.971(m),0.029(s))$
\end{itemize}
\ \\ \ \\ 

\ul{We can now calculate $P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})$:}
\begin{center}
\begin{tabular}{cc|ccc}
 & & \multicolumn{3}{c}{\Var{Angina?}} \\ 
 & & \St{no} & \St{mild} & \St{severe} \\ \hline
\multirow{2}{0.5cm}{\Var{Cold?}} & \St{no} & $0$  &
$0.968$ & $0.029$ \\  
& \St{yes} & $0$ & $0.003$ & $0$ \\ \hline
\end{tabular}
\end{center}

}

\end{slide}
}
}
{
\begin{slide}{Joint probabilities II}
From the \Green{fundamental rule} we have:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}}) = P(\VarM{Angina?}|\VarM{Cold?},\St{\bar{e}})P(\VarM{Cold?}|\St{\bar{e}})
\]
\ul{Assume that:}\newline
\hspace*{0.5cm}$\St{e}=(\VarM{Fever?}=\StM{no},\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})$.\newline\newline

\ul{We can calculate:} $P(\VarM{Cold?}|\St{\bar{e}})=(0.997(n),0.003(y))$\newline

\ul{As well as:}
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{yes},\St{\bar{e}})=(0(n),1(m),0(s))$
\item $P(\VarM{Angina?}|\VarM{Cold?}=\StM{no},\St{\bar{e}})=(0(n),0.971(m),0.029(s))$
\end{itemize}
\ \\ \ \\ 

\ul{We can now calculate $P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})$:}
\begin{center}
\begin{tabular}{cc|ccc}
 & & \multicolumn{3}{c}{\Var{Angina?}} \\ 
 & & \St{no} & \St{mild} & \St{severe} \\ \hline
\multirow{2}{0.5cm}{\Var{Cold?}} & \St{no} & $0$  &
$0.968$ & $0.029$ \\  
& \St{yes} & $0$ & $0.003$ & $0$ \\ \hline
\end{tabular}
\end{center}

\end{slide}
}

%####################################################################################
%# Most probable explanation (MPE)
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Most probable explanation (MPE)}
\fromSlide*{1}{

We can find the most probable configuration of \Var{Cold?} and
\Var{Angina?} from:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})
\]
However, this can be achieved must faster:
\begin{itemize}
\item Use \Green{maximization} instead of \Green{summation} when marginalizing out a variable.
\end{itemize}
}
\fromSlide*{2}{
\ \\
\ \\
\ \\
\centerline{
This gives us MPE(\Var{Cold?})=\St{no} and MPE(\Var{Angina?})=\St{mild}.}
}
\end{slide}
}
}
{
\begin{slide}{Most probable explanation (MPE)}

We can find the most probable configuration of \Var{Cold?} and
\Var{Angina?} from:
\[
P(\VarM{Angina?},\VarM{Cold?}|\St{\bar{e}})
\]
However, this can be achieved must faster:
\begin{itemize}
\item Use \Green{maximization} instead of \Green{summation} when marginalizing out a variable.
\end{itemize}
\ \\
\ \\
\ \\
\centerline{
This gives us MPE(\Var{Cold?})=\St{no} and MPE(\Var{Angina?})=\St{mild}.}

\end{slide}
}

%####################################################################################
%# Is the evidence reliable?
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Is the evidence reliable?}

\fromSlide*{1}{
Since I see $\VarM{Fever?}=\StM{no}$ and $\VarM{SoreThroat?}=\StM{no}$
it seems questionable that I see spots!
\begin{itemize}
\item Can this warning be given by the system?
\item Is the evidence coherent?
\end{itemize}
}
\fromSlide*{2}{
\ \\
\ \\
\ \\

For a coherent case covered by the model we expect the evidence to
support each other:
\[
P(\St{e_1},\St{e_2})>P(\St{e_1})P(\St{e_2})
\]
We can measure this using:
\[
\text{conf}(\St{e_1},\St{e_2})=\log_2\frac{P(\St{e_1})P(\St{e_2})}{P(\St{e_1},\St{e_2})}
\]
Thus, if $\text{conf}(\St{e_1},\St{e_2})>0$ we take it as an indication that the evidence is
  conflicting.
}
\end{slide}
}
}
{
\begin{slide}{Is the evidence reliable?}

Since I see $\VarM{Fever?}=\StM{no}$ and $\VarM{SoreThroat?}=\StM{no}$
it seems questionable that I see spots!
\begin{itemize}
\item Can this warning be given by the system?
\item Is the evidence coherent?
\end{itemize}
\ \\
\ \\
\ \\

For a coherent case covered by the model we expect the evidence to
support each other:
\[
P(\St{e_1},\St{e_2})>P(\St{e_1})P(\St{e_2})
\]
We can measure this using:
\[
\text{conf}(\St{e_1},\St{e_2})=\log_2\frac{P(\St{e_1})P(\St{e_2})}{P(\St{e_1},\St{e_2})}
\]
Thus, if $\text{conf}(\St{e_1},\St{e_2})>0$ we take it as an indication that the evidence is
  conflicting.

\end{slide}

}

%####################################################################################
%# Example
%####################################################################################


\begin{slide}{Example}

\[
\begin{split}
\text{conf}&(\VarM{Fever?}=\StM{no},\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})\\
&=\log_2\frac{P(\VarM{Fever?}=\StM{no})P(\VarM{SeeSpots?}=\StM{yes})P(\VarM{SoreThroat?}=\StM{no})}{P(\VarM{Fever?}=\StM{no},\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})}\\
&=\log_2\frac{0.960\cdot  0.002\cdot 0.978}{7.5131\cdot 10^{-7}} \\
&= \log_2(24993.47) = 11.32 
\end{split}
\]
\ \\
\ \\
\ \\

\Red{
\begin{center}
\fbox{Thus, we take it as an indication that the evidence is
  conflicting!}
\end{center}
}

\end{slide}



%####################################################################################
%# What are the crucial findings?
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{What are the crucial findings?}

\fromSlide*{1}{
We would like to answer questions such as:
\begin{itemize}
\item What are the crucial findings?\newline
\item What if one of the findings were changed or removed?\newline
\item What set of findings would be sufficient for the conclusion?
\end{itemize}
\ \\
\ \\
\ \\

\ul{Assume the conclusion that I suffer from mild angina:} \newline

}
\fromSlide*{2}{

It is not enough with $\VarM{SeeSpots?}=\StM{yes}$:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes})=(0(n),0.024(m),0.976(s))$\newline
\end{itemize}
However, $\VarM{SeeSpots?}=\StM{yes}$ and
$\VarM{SoreThroat?}=\StM{no}$ is sufficient:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})=(0(n),0.884(m),0.116(s))$\newline
\end{itemize}
In this case findings on $\VarM{Fever?}$ is irrelevant, e.g.:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no},\VarM{Fever?}=\StM{high})=(0(n),0.683(m),0.317(s))$\newline
\end{itemize}
}
\end{slide}
}
}
{
\begin{slide}{What are the crucial findings?}


We would like to answer questions such as:
\begin{itemize}
\item What are the crucial findings?\newline
\item What if one of the findings were changed or removed?\newline
\item What set of findings would be sufficient for the conclusion?
\end{itemize}
\ \\
\ \\
\ \\

\ul{Assume the conclusion that I suffer from mild angina:} \newline


It is not enough with $\VarM{SeeSpots?}=\StM{yes}$:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes})=(0(n),0.024(m),0.976(s))$\newline
\end{itemize}
However, $\VarM{SeeSpots?}=\StM{yes}$ and
$\VarM{SoreThroat?}=\StM{no}$ is sufficient:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no})=(0(n),0.884(m),0.116(s))$\newline
\end{itemize}
In this case findings on $\VarM{Fever?}$ is irrelevant, e.g.:
\begin{itemize}
\item $P(\VarM{Angina?}|\VarM{SeeSpots?}=\StM{yes},\VarM{SoreThroat?}=\StM{no},\VarM{Fever?}=\StM{high})=(0(n),0.683(m),0.317(s))$\newline
\end{itemize}

\end{slide}
}

%####################################################################################
%# Sensitivity to variations in parameters
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Sensitivity to variations in parameters}

\fromSlide*{1}{
The initial tables:\newline

\hspace*{-0.4cm}\begin{tabular}{cc}
\begin{tabular}{c|cccccc}
\Var{Angina?} & \multicolumn{2}{c}{\St{no}} &
  \multicolumn{2}{c}{\St{mild}} & \multicolumn{2}{c}{\St{severe}} \\
\Var{Cold?} & \St{no} & \St{yes} & \St{no} & \St{yes} & \St{no} &
  \St{yes} \\ \hline
\St{no} & $0.995$ & $0.6$ & $0.3$ & $0.15$ & $0.001$ & $0$  \\
\St{yes} & $0.005$  & $0.4$ & $0.7$ & $0.85$ & $0.999$ & $1$  \\
\multicolumn{7}{c}{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}
\end{tabular}
&
\begin{tabular}{c|ccc}
\Var{Angina?} & \St{no} &
  \St{mild} & \St{severe} \\ \hline
\St{no} & $1$ & $0.99$  & $0$   \\
\St{yes} & $0$ & $0.01$ & $1$   \\
\multicolumn{4}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{tabular}

\ \\
\ \\
\ \\


}
\fromSlide*{2}{
Assume that we have the parameters: \newline

\hspace*{-0.4cm}\begin{tabular}{cc}
\begin{tabular}{c|cccccc}
\Var{Angina?} & \multicolumn{2}{c}{\St{no}} &
  \multicolumn{2}{c}{\St{mild}} & \multicolumn{2}{c}{\St{severe}} \\
\Var{Cold?} & \St{no} & \St{yes} & \St{no} & \St{yes} & \St{no} &
  \St{yes} \\ \hline
\St{no} & $0.995$ & $0.6$ & $0.3$ & $0.15$ & $\fbox{t}$ & $0$  \\
\St{yes} & $0.005$  & $0.4$ & $0.7$ & $0.85$ & $0.999$ & $1$  \\
\multicolumn{7}{c}{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}
\end{tabular}
&
\begin{tabular}{c|ccc}
\Var{Angina?} & \St{no} &
  \St{mild} & \St{severe} \\ \hline
\St{no} & $1$ & $0.99$  & $0$   \\
\St{yes} & $0$ & $\fbox{s}$ & $1$   \\
\multicolumn{4}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{tabular}
\ \\

\ul{We want e.g.:}
\[
P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(t)\text{ ; }P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(s)\text{ ; }P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(s,t)
\]

}
\end{slide}
}
}
{
\begin{slide}{Sensitivity to variations in parameters}

The initial tables:\newline

\hspace*{-0.4cm}\begin{tabular}{cc}
\begin{tabular}{c|cccccc}
\Var{Angina?} & \multicolumn{2}{c}{\St{no}} &
  \multicolumn{2}{c}{\St{mild}} & \multicolumn{2}{c}{\St{severe}} \\
\Var{Cold?} & \St{no} & \St{yes} & \St{no} & \St{yes} & \St{no} &
  \St{yes} \\ \hline
\St{no} & $0.995$ & $0.6$ & $0.3$ & $0.15$ & $0.001$ & $0$  \\
\St{yes} & $0.005$  & $0.4$ & $0.7$ & $0.85$ & $0.999$ & $1$  \\
\multicolumn{7}{c}{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}
\end{tabular}
&
\begin{tabular}{c|ccc}
\Var{Angina?} & \St{no} &
  \St{mild} & \St{severe} \\ \hline
\St{no} & $1$ & $0.99$  & $0$   \\
\St{yes} & $0$ & $0.01$ & $1$   \\
\multicolumn{4}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{tabular}

\ \\
\ \\
\ \\



Assume that we have the parameters: \newline

\hspace*{-0.4cm}\begin{tabular}{cc}
\begin{tabular}{c|cccccc}
\Var{Angina?} & \multicolumn{2}{c}{\St{no}} &
  \multicolumn{2}{c}{\St{mild}} & \multicolumn{2}{c}{\St{severe}} \\
\Var{Cold?} & \St{no} & \St{yes} & \St{no} & \St{yes} & \St{no} &
  \St{yes} \\ \hline
\St{no} & $0.995$ & $0.6$ & $0.3$ & $0.15$ & $\fbox{t}$ & $0$  \\
\St{yes} & $0.005$  & $0.4$ & $0.7$ & $0.85$ & $0.999$ & $1$  \\
\multicolumn{7}{c}{$P(\VarM{Sore throat?}|\VarM{Angina?},\VarM{Cold?})$}
\end{tabular}
&
\begin{tabular}{c|ccc}
\Var{Angina?} & \St{no} &
  \St{mild} & \St{severe} \\ \hline
\St{no} & $1$ & $0.99$  & $0$   \\
\St{yes} & $0$ & $\fbox{s}$ & $1$   \\
\multicolumn{4}{c}{$P(\VarM{See spots?}|\VarM{Angina?})$}
\end{tabular}
\end{tabular}
\ \\

\ul{We want e.g.:}
\[
P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(t)\text{ ; }P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(s)\text{ ; }P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(s,t)
\]
\end{slide}


}

%####################################################################################
%# Sensitivity analysis
%####################################################################################

\PDForPS{
\overlays{2}{
\begin{slide}{Sensitivity analysis}

\fromSlide*{1}{
\ul{\Green{Theorem:}} 
\[
P(\St{\bar{e}})(t) = \alpha t+\beta = x(t)
\]
 \ \\ \ \\
Thus, we also have that
$P(\VarM{Angina?}=\StM{mild},\St{\bar{e}})(t)=a\cdot t + b=y(t)$, and therefore:
\[
P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(t) = \frac{y(t)}{x(t)}
\]
}
\fromSlide*{2}{
\ \\
\ \\
\ \\

For $t=0.001$ we have $x(t)=7.513\cdot 10^{-7}$ and $y(t)=7.298\cdot
10^{-7}$. \newline \newline

If we change $t$ to $0.002$ and propagate we get:
\[
x(0.002)=7.7286\cdot 10^{-7}\hspace*{0.5cm}y(0.002) = 7.2975\cdot 10^{-7}
\]
\centerline{
\Red{We can now determine the coefficients $\alpha$, $\beta$,
  $a$ and $b$!}
}
}
\end{slide}
}
}
{
\begin{slide}{Sensitivity analysis}


\ul{\Green{Theorem:}} 
\[
P(\St{\bar{e}})(t) = \alpha t+\beta = x(t)
\]
 \ \\ \ \\
Thus, we also have that
$P(\VarM{Angina?}=\StM{mild},\St{\bar{e}})(t)=a\cdot t + b=y(t)$, and therefore:
\[
P(\VarM{Angina?}=\StM{mild}|\St{\bar{e}})(t) = \frac{y(t)}{x(t)}
\]

\ \\
\ \\
\ \\

For $t=0.001$ we have $x(t)=7.513\cdot 10^{-7}$ and $y(t)=7.298\cdot
10^{-7}$. \newline \newline

If we change $t$ to $0.002$ and propagate we get:
\[
x(0.002)=7.729\cdot 10^{-7}\hspace*{0.5cm}y(0.002) = 7.299\cdot 10^{-7}
\]
\centerline{
\Red{We can now determine the coefficients $\alpha$, $\beta$,
  $a$ and $b$!}
}

\end{slide}
}
\end{document}





