You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>We read this as “the probability that the car is broken given that the car is red”. Such a probability is known as a <em>conditional probability</em>. We discuss these in more detail in <ahref="probability_theory_1a.html#sec-cond-uncond" class="quarto-xref"><span>Section 8.13</span></a>.</p>
755
755
<p>In our original problem, we ask what the chance is of a car being broken given that a mechanic approved it. As discussed under “Ratios of proportions”, it can be calculated with:</p>
756
-
<p><spanclass="math display">\[
757
-
\begin{align*}
756
+
<p><spanclass="math display">\[\begin{align*}
758
757
P(\text{car broken | mechanic approved}) = \\
759
758
P(\text{car broken and mechanic approved}) / P(\text{mechanic approved})
760
-
\end{align*}
761
-
\]</span></p>
759
+
\end{align*}\]</span></p>
762
760
<p>We have already used <spanclass="math inline">\(B\)</span> to mean “broken” (above), so let us use <spanclass="math inline">\(A\)</span> to mean “mechanic approved”. Then we can write the statement above in a more compact way:</p>
<p>Let’s discuss a very relevant example. You get a COVID test, and the test is negative. Now, you would like to know what the chance is of you having COVID.</p>
770
+
<p>Let’s discuss a very relevant example. You get a Covid test, and the test is negative. Now, you would like to know what the chance is of you having Covid.</p>
773
771
<p>We have the following information:</p>
774
772
<ul>
775
-
<li>1.5% of people in your area have COVID</li>
776
-
<li>The false positive rate of the tests (i.e., that they detect COVID when it is absent) is very low at 0.5%</li>
777
-
<li>The false negative rate (i.e., that they fail to detect COVID when it is present) is quite high at 40%</li>
773
+
<li>1.5% of people in your area have Covid</li>
774
+
<li>The false positive rate of the tests (i.e., that they detect Covid when it is absent) is very low at 0.5%</li>
775
+
<li>The false negative rate (i.e., that they fail to detect Covid when it is present) is quite high at 40%</li>
<spanid="cb11-8"><ahref="#cb11-8" aria-hidden="true" tabindex="-1"></a><spanclass="co"># For each person, generate a True or False label,</span></span>
797
-
<spanid="cb11-9"><ahref="#cb11-9" aria-hidden="true" tabindex="-1"></a><spanclass="co"># indicating that they have / don't have COVID.</span></span>
795
+
<spanid="cb11-9"><ahref="#cb11-9" aria-hidden="true" tabindex="-1"></a><spanclass="co"># indicating that they have / don't have Covid.</span></span>
<spanid="cb11-15"><ahref="#cb11-15" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Calculate the numbers of people with and without COVID.</span></span>
801
+
<spanid="cb11-15"><ahref="#cb11-15" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Calculate the numbers of people with and without Covid.</span></span>
<spanid="cb11-19"><ahref="#cb11-19" aria-hidden="true" tabindex="-1"></a><spanclass="co"># In this array, we will store, for each person, whether they</span></span>
808
806
<spanid="cb11-20"><ahref="#cb11-20" aria-hidden="true" tabindex="-1"></a><spanclass="co"># had a positive or a negative test.</span></span>
<spanid="cb11-29"><ahref="#cb11-29" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Draw test results for people without COVID.</span></span>
815
+
<spanid="cb11-29"><ahref="#cb11-29" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Draw test results for people without Covid.</span></span>
818
816
<spanid="cb11-30"><ahref="#cb11-30" aria-hidden="true" tabindex="-1"></a><spanclass="co"># ~person_has_covid` flips all Boolean values from FALSE to TRUE</span></span>
819
817
<spanid="cb11-31"><ahref="#cb11-31" aria-hidden="true" tabindex="-1"></a><spanclass="co"># and from TRUE to FALSE.</span></span>
<spanid="cb11-37"><ahref="#cb11-37" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Get the COVID statuses of all those with negative tests</span></span>
823
+
<spanid="cb11-37"><ahref="#cb11-37" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Get the Covid statuses of all those with negative tests</span></span>
826
824
<spanid="cb11-38"><ahref="#cb11-38" aria-hidden="true" tabindex="-1"></a><spanclass="co"># (`test_result` is a Boolean mask, like `[True, False, False, True, ...]`,</span></span>
827
825
<spanid="cb11-39"><ahref="#cb11-39" aria-hidden="true" tabindex="-1"></a><spanclass="co"># and `~test_result` flips all Boolean values to `[False, True, True, False, ...]`.</span></span>
<spanid="cb11-42"><ahref="#cb11-42" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Now, count how many with COVID had a negative test results.</span></span>
828
+
<spanid="cb11-42"><ahref="#cb11-42" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Now, count how many with Covid had a negative test results.</span></span>
<spanid="cb11-45"><ahref="#cb11-45" aria-hidden="true" tabindex="-1"></a><spanclass="co"># And how many people, overall, had negative test results.</span></span>
<li><spanclass="math inline">\(T^-\)</span> means the Covid <em>test</em> was negative.</li>
856
854
</ul>
857
855
<p>For example <spanclass="math inline">\(P(C^+ | T^-)\)</span> is the probability (<spanclass="math inline">\(P\)</span>) that you do actually have Covid (<spanclass="math inline">\(C^+\)</span>) <em>given that</em> (<spanclass="math inline">\(|\)</span>) the test was negative (<spanclass="math inline">\(T^-\)</span>).</p>
858
-
<p>We would like to know the probability of having COVID<em>given that</em> your test was negative (<spanclass="math inline">\(P(C^+ | T^-)\)</span>). Using the conditional probability relationship from above, we can write:</p>
856
+
<p>We would like to know the probability of having Covid<em>given that</em> your test was negative (<spanclass="math inline">\(P(C^+ | T^-)\)</span>). Using the conditional probability relationship from above, we can write:</p>
859
857
<p><spanclass="math display">\[
860
858
P(C^+ | T^-) = P(C^+ \text{ and } T^-) / P(T^-)
861
859
\]</span></p>
862
860
<p>We see from the tree diagram that <spanclass="math inline">\(P(C^+ \text{ and } T^-) = P(T^- | C^+) * P(C^+) = .4 * .015 = 0.006\)</span>.</p>
863
861
<!---
864
862
**TODO: ADD REFERENCE TO SUMMATION OF MUTUALLY EXCLUSIVE PROBABILITIES**
865
863
-->
866
-
<p>We observe that <spanclass="math inline">\(P(T^-) = P(T^- \text{ and } C^-) + P(T^- \text{ and } C^+)\)</span>, i.e. that we can obtain a negative test result through two paths, having COVID or not having COVID. We expand these further as conditional probabilities:</p>
864
+
<p>We observe that <spanclass="math inline">\(P(T^-) = P(T^- \text{ and } C^-) + P(T^- \text{ and } C^+)\)</span>, i.e. that we can obtain a negative test result through two paths, having Covid or not having Covid. We expand these further as conditional probabilities:</p>
0 commit comments