# Bayesian network calculations

I'm new to probability theory and Bayesian networks so I really don't understand how to calculate some probabilities based on this network:

$$\require{enclose}\boxed{\begin{array}{c|cc}X\backslash Y&\mathrm c&\mathrm d\\\hline\mathrm a&0.85&0.15\\\mathrm b&0.65&0.35\end{array}}\quad\begin{array}{c}\boxed{\begin{array}{c|cc}X&\mathrm a&\mathrm b\\\hline0&0.2&0.8\end{array}}\\\enclose{circle}{\rm X}\\\swarrow~~\searrow\\\enclose{circle}{\rm Y}\qquad\quad\enclose{circle}{\rm Z}\end{array}\quad\boxed{\begin{array}{c|cc}X\backslash Z&\mathrm e&\mathrm f\\\hline\mathrm a&0.70&0.30\\\mathrm b&0.25&0.75\end{array}}$$

Network

I want to caclute:

$$\qquad\text{Calculate:}\\~(i)~~\mathsf P(X=\mathrm a\mid Y=\mathrm c, Z=\mathrm e)\\(ii)~~\mathsf P(Z=\mathrm e\mid Y=\mathrm c)$$

Calculate

• Have you made any progress? Commented Mar 12, 2021 at 1:51

The Diagram expresses the factorisation (for any $$x,y,z$$) of: $$\mathsf P(X{=}x, Y{=}y, Z{=}z)=\mathsf P(X{=}x)\,\mathsf P(Y{=}y\mid X{=}x)\,\mathsf P(Z{=}z\mid X{=}x)$$
The table gives you: $${\qquad\quad\mathsf P(X{=}\mathrm a)=0.2\\ \mathsf P(Y{=}\mathrm c\mid X{=}\mathrm a)=0.85\\ \mathsf P(Z{=}\mathrm e\mid X{=}\mathrm a)=0.70}$$
The definition of conditional probability, and Law of Total Probability say: \begin{align}\mathsf P(X{=}\mathrm a\mid Y{=}\mathrm c, Z{=}\mathrm e)&=\dfrac{\mathsf P(X{=}\mathrm a, Y{=}\mathrm c, Z{=}\mathrm e)}{\mathsf P(Y{=}\mathrm c, Z{=}\mathrm e)}\\[2ex]&=\dfrac{\mathsf P(X{=}\mathrm a, Y{=}\mathrm c, Z{=}\mathrm e)}{\mathsf P(X{=}\mathrm a, Y{=}\mathrm c, Z{=}\mathrm e)+\mathsf P(X{=}\mathrm b, Y{=}\mathrm c, Z{=}\mathrm e)}\end{align}
• No, it is similarly: $$\mathsf P(Z{=}\mathrm e\mid Y{=}\mathrm c)=\dfrac{\mathsf P(X{=}\mathrm a,Y{=}\mathrm c,Z{=}\mathrm e)+\mathsf P(X{=}\mathrm b,Y{=}\mathrm c,Z{=}\mathrm e)}{\mathsf P(X{=}\mathrm a,Y{=}\mathrm c)+\mathsf P(X{=}\mathrm b,Y{=}\mathrm c)}$$ Commented Mar 10, 2021 at 1:29