diff --git a/source/statistics/bayes_theorem.rst b/source/statistics/bayes_theorem.rst index 7168423..7f80509 100644 --- a/source/statistics/bayes_theorem.rst +++ b/source/statistics/bayes_theorem.rst @@ -28,10 +28,44 @@ The red area represents :math:`P(B)=a3+a4`. Thus, to compute :math:`P(A|B)` we d This final formula is the Baye's Theorem. See the `3Blue1Brown video `__ for a better understanding. +.. note:: + The following notation is also used: + + .. math:: + P(A|B)=\frac{a3}{a3+a4}=\frac{P(A \cap B)}{P(B)} + 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? +Problem +^^^^^^^^ + +.. image:: figures/cat.jpg + :align: center + :width: 150px + +Anna says she is itchy. There is a test for Allergy to Cats, but this test is not always right: + +* For people that 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 Anna's test says *Yes*, what are the chances that she really has the allergy? + +Solution +^^^^^^^^^ + +Let draw the little diagram: + +.. image:: figures/bayes_theorem_example.svg + :width: 400px + :align: center + + +.. math:: + P(Allergy|Yes)&=\frac{a3}{a3+a4} + + &=\frac{P(Allergy)P(Yes|Allergy)}{P(Allergy)P(Yes|Allergy)+P(\neg Allergy)*P(Yes|\neg Allergy)} + + &=\frac{0.01 \times 0.80}{0.01 \times 0.80 + 0.99 \times 0.10} = 0.0747 + +The chances that Anna really has Allergy is about 7%. diff --git a/source/statistics/figures/bayes_theorem_example.svg b/source/statistics/figures/bayes_theorem_example.svg new file mode 100644 index 0000000..5c337fb --- /dev/null +++ b/source/statistics/figures/bayes_theorem_example.svg @@ -0,0 +1,866 @@ + + + +Populationa1a4a3a2 diff --git a/source/statistics/figures/cat.jpg b/source/statistics/figures/cat.jpg new file mode 100644 index 0000000..cbcf465 Binary files /dev/null and b/source/statistics/figures/cat.jpg differ