Ch4 Figure2


In [1]:
# It turns out that there's a number of things that might decrease the probability of someone participating. If people have to fast the night before then they might be 30% less likely to participate. They also might be 20% less likely to participate if there are blood tests and needles.

# one classical approach to view this type of problems is bayes net as below
# And we assign joint probability for each node below

Table 1. (Assume) 30% of people will be willing to the night prior.

p(F) T F
0.3 0.7

Table 2. (Assume) 40% of people will be willing to do blood test.

p(B) T F
0.4 0.6

Table 3. 30% likely if F is True, 20% likely if B is True.

(F, B) (T,T) (T,F) (F,T) (F,F)
p(T) T 0.19 0.125 0.15 0.3
F 0.81 0.875 0.85 0.7

Table 4. 10% not accurate if B is False, (assume) 15% accurate if F is False.

(F, B) (T,T) (T,F) (F,T) (F,F)
p(A) T 0.7 0.6 0.4 0.39
F 0.3 0.4 0.6 0.61

We can to use the probility given above to calculate probability such as

"Given a blood test, what's the probability of accurate result": $$ p(A|B) = \frac {p(A,B)}{p(B)} \\ p(A,B) = \Sigma_Fp(F) p(B) p(A|F,B) = 0.3 \times 0.4 \times 0.7 + 0.7 \times 0.4 \times 0.4 \\ p(B) = 0.4 \\ p(A|B) = 0.12544/0.4 = 0.3136 $$

"Given a blood test, what's the probability of trial": $$ p(T|B) = \frac {p(T,B)}{p(B)} \\ p(T,B) = \Sigma_Fp(F) p(B) p(T|F,B) = 0.3 \times 0.4 \times 0.19 + 0.7 \times 0.4 \times 0.15 \\ p(B) = 0.4 \\ p(T|B) = 0.0648/0.4 = 0.162 $$

Suppose profit is a function of trial and accuracy, with these two probabilities, we can infer what the profit would look like, and compare with versus without blood test.