# Inference Bayes Network

Given the Asia net.

I am computing something like:

Tuberculosis Present:
$P(T)=P(V)P(T|V)+ P( \lnot V)*P(T| \lnot V)$ = (0.1)(0.05)+(0.99)(0.01)=0.0104
Tuberculosis Absent:
1.0 - 0.0104 =0.99

Lung Cancer Present:
$P(L)=P(S)P(L|S)+ P( \lnot S)*P(L| \lnot S)$ = (0.5)(0.10)+(0.50)(0.01)=0.055
Lung Cancer Absent:
1.0 - 0.055 =0.945

Bronchitis Present:
$P(B)=P(S)P(B|S)+ P( \lnot B)*P(B| \lnot S)$ = (0.5)(0.60)+(0.50)(0.30)=0.45
Bronchitis Absent:
1.0 - 0.45 =0.55

for Tuberculosis or Cancer
$P(L)P(T)P(C|L,T)$ = (0.055)(0.0104)(1.0) = 0.000572
$P(L)P(\lnot T)P(C|L,\lnot T)$ = (0.055)(1-0.0104)(1.0)=(0.055)(0.9896)(1.0)=0.054428
$P(\lnot L)P(T)P(C|\lnot L,T)$ = (1-0.055)(0.0104)(1.0)=(0.945)(0.0104) 1.0)=0.009828
$P(\lnot L)P( \lnot T )P(C|\lnot L,\lnot T)$ = (1-0.055)(1-0.0104)
(0.0)=0.0

doing the sum;


Tuberculosis or Cancer True:
$P(C)$ =0.000572 + =0.054428 + 0.009828 + 0.0 = 0.064828
Tuberculosis or Cancer False:
1.0 - 0.064828 = 0.935

X ray Abnormal:
$P(X)= P(C)P(X|C)+P(\lnot C)P(X|\lnot C)$ = (0.064828)(0.98)+ (1-0.064828)(0.05)= 0.06353144+(0.935172)(0.05)=0.11029004
X ray normal:
1-0.11=0.89

for Dyspnea
$P(C)P(B)P(D|E,B)$ = (0.064828)(0.45)(0.9) = 0.02625534
$P(C)P(\lnot B)P(D|E,\lnot B)$ = (0.064828)(1-0.45)(0.7) = 0.02495878
$P(\lnot C)P(B)P(D|E,B)$ = (1-0.064828)(0.45)(0.8) = 0.33666192
$P(\lnot C)P(\lnot B)P(D|E, \lnot B)$ =(1-0.064828)(1-0.45)(0.1) = 0.05143446

adding all:


Dyspnea Present:
$P(D)$ = 0.436
Dyspnea Absent:
1 - 0.436 = 0.564

To compare I was viewing:

1. How would you make queries like
• $P(D=y|V=y,S=y)$?
• $P(D=y|C=y,B=y)$?
• $P(D=n|L=y,S=y)$?
• $P(X=n|V=y,S=n)$?
• $P(C=y|L=y,T=n)$?

and How do you answer a more complex query like:

• $P(X=y|V=y,C=n,S=y)$?

To answer them I was doing something like:

$$P(D=y|V=y,S=y) = \frac{P(V=y,S=y|D=y)}{P(V=y,S=y|D=y)P(D=y)+P(V=y,S=y|D=n)P(D=n)}$$ = ??

How do I replace values, and solve these queries?

Also one more question:

If I set the probability of a patient $P(T)$=1 that has Tuberculosis, (this is an observed event), How does this modifies $P(A)$ or $P(T|A)$?

-

When you say "Dyspnea Present: P(C,B|D) = 0.436" I assume you mean that the marginal (or total) probability of Dyspnea is 0.436. In that case the correct notation is $P(D) = 0.436$.

When you write $P(A|B|C)$, I assume you mean "conditional probability of A given B and C". In that case the correct notation is $P(A|B,C)$. And in order to calculate this, we use:

$$P(A|B,C) = P(A, B, C)/P(B, C)$$

If $B$ and $C$ are independent, that is, if they share no ancestors (where I consider the node to be its own ancestor), then $P(B,C) = P(B)P(C)$. If they only share ancestor $D$, then $B$ and $C$ are conditionally independent given $D$, ie

$$P(B,C) = \sum_{d} P(B|D) P(C|D) P(D=d)$$ where $d$ ranges over all possible values of $D$.

-
Ok, I updated the question, making correct notation. Could you please solve a query?, I think seeing an example or two would be enough. Taking the formula you posted, for $P(D=n|L=y,S=y)$ = $P(D,L,S)/P(L,S) = P(L,S|D)/ (\sum_D P(L,S))$ or something like that? I do not get it because L has ancestor $S$..., could you please put the numbers, to solve it? –  cMinor Mar 27 '11 at 19:59
Also in your answer, What happens if $B$ and $C$ have different ancestor but have one like the case of $Tuberculosis$ and $Bronchitis$, (they do not share the same ancestor)?, and the numerator How is it replaced? –  cMinor Mar 27 '11 at 20:09