# Bayesian Network and conditional probability - concrete example

bayesian network picture

Abbreviations:

A ... Visited Asia

S ... Smoker

T ... Has tuberculosis

L ... Has lung cancer

B ... Has bronchititis

E ... Has either tuberculosis or lung cancer

X ... Has positive xray

D ... Has dyspnoea

The joint probability factorization for this Bayesian network is:

P(A) * P(S) * P(T|A) * P(L|S) * P(B|S) * P(E|T,L) * P(X|E) * P(D|E,B)

I want to compute the conditional probability P(L=1|A=1,X=1,S=1).

If I'm not mistaken, it should be equal to:

$$P(L=1,A=1,X=1,S=1) / P(A=1,X=1,S=1)$$

where

$$P(L=1,A=1,X=1,S=1)$$ = $$\sum_{T={0,1},B={0,1},E={0,1},D={0,1}} P(A=1) * P(S=1) * P(T|A=1) * P(L=1|S=1) * P(B|S=1) * P(E|T,L=1) * P(X=1|E) * P(D|E,B)$$

Can someone please confirm whether my reasoning is correct? This example appears in many textbooks but I'm yet to find an actual demonstration of its solution, which leaves me without validation of whether I understand the concept correctly. Thank you in advance.

• There is no $P(T | A)$ in the network Dec 30, 2019 at 6:51
• @Joitandr Ah, you are right, I made a typo in the factorization and wrote P(T|V) instead of P(T|A). Edited, thank you. Other than that - is it OK? Dec 30, 2019 at 11:36

$$P(A) * P(S) * P(T|A) * P(L|S) * P(B|S) * P(E|T,L) * P(X|E) * P(D|E,B)$$

I want to compute the conditional probability $$P(L=1|A=1,X=1,S=1)$$.

To save typespace I am going to use $$L^1$$ to indicate $$L=1$$ and abbreviate $$\sum_{a\in\{0,1\}}$$ to $$\sum_a$$.

\begin{align}\mathsf P(L^1\mid A^1,X^1,S^1)&=\dfrac{\mathsf P(L^1, X^1\mid A^1,S^1)}{\mathsf P(X^1\mid A^1,S^1)}\\[2ex]&=\cfrac{\mathsf P(L^1\mid S^1)\sum_e\mathsf P(X^1\mid E^e)\sum_t\mathsf P(E^e\mid T^t,L^1)\mathsf P(T^t\mid A^1)}{\sum_e\mathsf P(X^1\mid E^e)\sum_\ell\mathsf P(L^\ell\mid S^1)\sum_t\mathsf P(E^e\mid T^t,L^\ell)\mathsf P(T^t\mid A^1)}\end{align}

Notes:

Yes, you were indeed correct that

\small\begin{align}\mathsf P(L^1,A^1,X^1,S^1)&=\sum\limits_{t,b,e,d}{\mathsf P(A^1)\mathsf P(S^1)\mathsf P(T^t\mid A^1)\mathsf P(L^1\mid S^1)\mathsf P(B^b\mid S^1)\mathsf P(E^e\mid T^t,L^1)\mathsf P(X^1\mid E^e)\mathsf P(D^d|E^e,B^b)}\end{align}

However, by comutivity and distribution this simplifies\small\begin{align}&\quad \mathsf P(L^1,A^1,X^1,S^1)\\[1ex]&=\mathsf P(A^1)\mathsf P(S^1)\mathsf P(L^1\mid S^1)\sum\limits_{t}{\mathsf P(T^t\mid A^1)\sum_e\mathsf P(X^1\mid E^e)\mathsf P(E^e\mid T^t,L^1)\sum_b\mathsf P(B^b\mid S^1)\sum_d\mathsf P(D^d\mid E^e,B^b)}\\[1ex]&=\mathsf P(A^1)\mathsf P(S^1)\mathsf P(L^1\mid S^1)\sum\limits_{t}{\mathsf P(T^t\mid A^1)\sum_e\mathsf P(X^1\mid E^e)\mathsf P(E^e\mid T^t,L^1)}\end{align}

Similarly for $$\mathsf P(A^1,X^1,S^1)$$.  Dividing and cancelling common terms then derives $$\mathsf P(L^1\mid A^1,X^1,S^1)$$ as above.