# Is it possible to compute $P( F \mid S )$ given $P(F \mid S,A)$, $P(F \mid S, \lnot A)$?

I have a bayesian network, which has the following data:

$$P(S) = 0.07$$

$$P(A) = 0.01$$

$$P(F \mid S,A) = 1.0$$

$$P(F \mid S, \lnot A) = 0.7$$

$$P(F \mid \lnot S, A) = 0.9$$

$$P(F \mid \lnot S, \lnot A) = 0.1$$

And I'm asked to get $$P(F \mid S)$$. Is it possible? How can I deduce it?

This is a bit of a puzzle but you can compute a reasonable narrow limit even without knowing whether or not $$P(S,A) = P(S) P(A)$$.

Start with the contingency table relating $$P(S, A)$$, $$P(S,\neg A)$$, $$P(\neg S, A)$$, $$P(\neg S,\neg A)$$ to $$P(S)$$ and $$P(A)$$ :

$$\begin{array}{cc|c} P( S,A)& P(\neg S,A) & P(A) \\ P(S,\neg A)& P(\neg S,\neg A) & P(\neg A) \\ \hline P(S)& P(\neg S) & 1 \\ \end{array} \quad \rightarrow \quad \begin{array}{cc|c} x& 0.01-x & 0.01 \\ 0.07-x& 0.92+x & 0.99 \\ \hline 0.07& 0.93 & 1 \\ \end{array}$$

note that the cells must be between zero and one thus $$0 \leq x \leq 0.01$$

Then with

$$\begin{array}{rcrl}P(F|S) &= & & P(F|S,A) P(A|S) + P(F| S,\neg A) P(\neg A|S)\\ &=&& 1.0 \frac{x}{0.07} + 0.7 \frac{0.07-x}{0.07} \\ & = && 0.7 + 4 \frac{2}{7} x \end{array}$$

you get

$$0.7 \leq P(F|S) \leq 0.743$$

To solve $$P(F|S)$$ exactly you need to narrow down $$x$$ more precisely. Possibilities are:

• If you know $$P(F)$$ then you could use $$\begin{array}{rcrl}P(F) &= & & P(F|S,A) P(S,A) \\ && +& P(F|\neg S,A) P(\neg S,A) \\ &&+& P(F| S,\neg A) P(S, \neg A)\\&&+&P(F|\neg S,\neg A) P(\neg S,\neg A)\\ &=&& 1.0 (x) + 0.7 (0.07 - x) + 0.9 (0.01-x)+0.1(0.92+x) \\ & = && 0.15-0.5 x \end{array}$$

• If you know that $$S \perp \! \! \! \perp A$$ then you can use $$x = P(S,A) = P(S)P(A) = 0.0007$$

I believe you can deduce it. Using the product rule:

$$p(x,y) = p(x\mid y)p(y)$$

we have:

$$P(F\mid S) = \frac{P(F,S)}{P(S)}$$

we have $$P(S)$$ and we do not have $$P(F,S)$$, but we can use the addition rule:

$$p(x) = \sum_\limits y p(x, y)$$

$$P(F, S) = P(F,S,A) + P(F,S,\lnot A)$$

first term on the right side, using the product rule, is:

$$P(F,S,A) = P(F\mid S,A)P(S,A)$$

I assume that $$S$$ and $$A$$ are not conditionally dependent so we have:

$$P(F,S,A) = P(F\mid S, A)P(S)P(A)$$

for the second term on the right side, following the same logic, we have:

$$P(F,S,\lnot A) = P(F\mid S, \lnot A)P(S)P(\lnot A)$$

we have all the needed members so in the end we have:

$$P(F\mid S) = \frac{P(F\mid S, A)P(S)P(A) + P(F\mid S, \lnot A)P(S)P(\lnot A)}{P(S)}$$

• You're making an assumption to calculate it. Your assumption might not be true. – nbro Mar 1 '19 at 12:56
• True, maybe the assumption is correct, maybe it isn't, we'll see what op says. If assumption isn't correct you can't compute it I believe. – Brale Mar 1 '19 at 13:04

I do not think you can compute $$P(F \mid S=s)$$ only using your given probabilities (and no further independence assumption between your random variables).

First of all, note that $$P(F \mid S=s)$$ is the probability of $$F$$ (being equal to one of the values that $$F$$ can attain), given that the value of $$S$$ is $$s$$. Not also that $$P(F \mid S)$$ is a shorthand for $$P(F \mid S=s)$$.

In general, by the law of total probability, we have

\begin{align} P(A) &= P(A, B) + P(A, B^c) \\ &= P(A|B)P(B) + P(A|B^c)P(B^c) \\ &= P(B|A)P(A) + P(B|A^c)P(A^c) \end{align}

where $$B^c$$ is the complement of $$B$$ (in case $$A$$ and $$B$$ are sets or events).

So, in your specific case, we have

\begin{align} P(F \mid S) &= P(F \mid S, A)P(A \mid S) + P(F \mid S, \lnot A)P(\lnot A \mid S) \\ &= P(F \mid S, A) \frac{P(A, S)}{P(S)} + P(F \mid S, \lnot A)\frac{P(\lnot A, S)}{P(S)} \\ &= \frac{P(F, S, A)}{P(A, S)} \frac{P(A, S)}{P(S)} + \frac{P(F,S, \lnot A)}{P(\lnot A, S)}\frac{P(\lnot A, S)}{P(S)} \\ &= \frac{P(F, S, A)}{P(S)} + \frac{P(F,S, \lnot A)}{P(S)} \\ &= \frac{1}{P(S)} (P(F, S, A) + P(F,S, \lnot A) ) \\ &= \frac{P(F, S)}{P(S)} \end{align}

We $$P(F \mid S, A), P(S)$$ and $$P(F \mid S, \lnot A)$$, but we do not have $$P(A, S)$$, $$P(F, S, A)$$ or $$P(F, S)$$ (and I think we cannot retrieve them from your given probabilities).

(I will be happy to be corrected, if this conclusion is wrong. Maybe I'm not seeing another way of computing it now.)