Bayes' Theorem --------------- This page is inpired from: * `MathIsFun `__ * `Wikipedia `__ Theorem ========= The Bayes's theorem describes the probability of an event, based on prior knowledge of conditions that might be related to the event. To compute :math:`P(A|B)`, in other words, the probability of the event :math:`A` to happen, knowing that :math:`B` already happen, the following drawing can be used: .. image:: figures/bayes_theorem.svg :align: center :width: 400px | The red area represents :math:`P(B)=a3+a4`. Thus, to compute :math:`P(A|B)` we do: .. math:: P(A|B)=\frac{a3}{a3+a4}=\frac{P(A)P(B|A)}{P(A)P(B|A)+P(\neg A)P(B|\neg A)}=\frac{P(A)P(B|A)}{P(B)} This final formula is the Baye's Theorem. See the `3Blue1Brown video `__ for a better understanding. Example ========= Hunter says she is itchy. There is a test for Allergy to Cats, but this test is not always right: For people that really do have the allergy, the test says "Yes" 80% of the time For people that do not have the allergy, the test says "Yes" 10% of the time ("false positive") If 1% of the population have the allergy, and Hunter's test says "Yes", what are the chances that Hunter really has the allergy?