{"id":1890,"date":"2019-03-25T12:00:00","date_gmt":"2019-03-25T11:00:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/basics-of-conditional-probability\/"},"modified":"2026-07-05T03:22:17","modified_gmt":"2026-07-05T01:22:17","slug":"basics-of-conditional-probability","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/basics-of-conditional-probability\/","title":{"rendered":"Conditional Probability \u2013 Basics"},"content":{"rendered":"<p>I assume you have a basic knowledge of Probability. For example, if there a 3 red ball and 2 blue balls in a bag and someone picks on ball at random. What is the probability that it is a red ball? Or what is the probability of getting a 3 if a fair six-sided die is rolled? I&#8217;m sure you know it.<\/p>\n<p>But just in case you forgot, for the former,\u00a0 it&#8217;s 3\/5 and for the later, it is 1\/6.<\/p>\n<p>You may also want to to <a href=\"https:\/\/kindsonthegenius.com\/blog\/basics-of-decision-theory-how-medical-diagnosis-apps-work\">read Decision Theory.<\/a><\/p>\n<p>Now, conditional probability is also quite easy to understand. It simply tried to determine the probability of an event given a previous event.<\/p>\n<p>We would use an example to explain Conditional Probability.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong>Medical Diagnosis Example<\/strong><\/h4>\n<p>A medical diagnosis is carried out on patients with a heart disease called digitalis intoxication.\u00a0 To carry out this diagnoses, doctors measure the concentration of digitalis in the patient&#8217;s blood. (high concentration of digitalis does not automatically mean that this disease is present, but it make it more likely).<\/p>\n<p>&nbsp;<\/p>\n<p>So 136 patient&#8217;s were diagnosed and the results are tabulated below.<\/p>\n<ul>\n<li>T+\u00a0 = High concentration<\/li>\n<li>T &#8211;\u00a0 = low concentration<\/li>\n<li>D+ = disease present<\/li>\n<li>D-\u00a0 = disease absent<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-577 aligncenter\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2020\/09\/table-300x138.jpg\" alt=\"\" width=\"300\" height=\"138\" \/><\/p>\n<p>Let&#8217;s now understand what is happening here.<\/p>\n<p>The first figure 25,\u00a0 shows that 25 patient out of 136 has high concentration and also has the disease. This is 0.184<\/p>\n<p>Also, 15 patients out of 136 has high concentration but does not have the disease.<\/p>\n<p>Now before continue, let&#8217;s convert the table to frequencies, so we can apply it to larger population. We simply divide everything by 136. The resulting table is shown below.<\/p>\n<p>The figures can now represent probabilities.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-578 aligncenter\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2020\/09\/Table2-300x139.jpg\" alt=\"\" width=\"300\" height=\"139\" \/><\/p>\n<p>From the table:<\/p>\n<p>P(T+) = 0.294<\/p>\n<p>P(D+) = 0.316<\/p>\n<p>We can now ask: &#8216;if a doctor know that there was high concentration(that is the test was positive T+), what is the probability of the disease being present?&#8217;\u00a0 This is <em><strong>conditional probability<\/strong><\/em>.<\/p>\n<p>Looking only at the first row, we can see that out of the 40 patients who shows high concentration, 25 of them has the disease.<\/p>\n<p>Let&#8217;s denote\u00a0 the probability that a patient has the disease given that the test is positive by P(D+ | T+).<\/p>\n<p>This means conditional probability of D+ given T+.<\/p>\n<p>In this case<\/p>\n<p>P(D+ | T+) = 25\/40 = 0.625<\/p>\n<p>In the same way, we can calculate this probability as<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-579\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2020\/09\/Probability-300x141.jpg\" alt=\"\" width=\"245\" height=\"115\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>So this is what conditional probability is all about.<\/p>\n<p>But now we can also think of unconditional probability.<\/p>\n<p>From our calculation we can see that\u00a0 the unconditional probability of D+ is 0.316 while the conditional probability of T+\u00a0 given D+ is 0.625. This is almost twice the previous.<\/p>\n<p>This means that given that the test is positive (T+) makes the disease twice more likely to be present.<\/p>\n<p>Now what if the test is negative (T-)?<\/p>\n<p>Again, we can also find:<\/p>\n<p>P(D- | T-) = 0.574\/0.706 = 0.813<\/p>\n<p>We can then check the unconditional probability of D- which is 0.684 from the table.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong>False Positive and False Negative<\/strong><\/h4>\n<p>We can then find probability of false positive. That is probability that the patient has the disease given a negative test result (T-). We can represent this as:<\/p>\n<p><span style=\"font-size: 1rem;\">P(D- | T+) = 0.375<\/span><\/p>\n<p>Finally, the probability of False negative is given by:<\/p>\n<p><span style=\"font-size: 1rem;\">P(D+ | T-) = 0.1875<\/span><\/p>\n<p>&nbsp;<\/p>\n<h4><strong>Formal Definition of Conditional Probability<\/strong><\/h4>\n<p>Now that you clearly understand conditional probability, let&#8217;s now give a formal definition.<\/p>\n<p>If A and B are two events with P(B)\u00a0\u2260 0. Then the conditional probability of A given\u00a0 B is given by:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-580 aligncenter\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2020\/09\/Conditional-Probability-300x79.jpg\" alt=\"\" width=\"300\" height=\"79\" \/><\/p>\n<p>The idea behind this is that if we are given that an even B occurred, then the relevant sample space becomes B rather than the original sample size. And the condition probability is the probability measured over B.<\/p>\n<p>It the medical diagnosis example we calculate\u00a0 P(D+ | T+) over the 40 patients who have high concentration (T+)<\/p>\n<p>&nbsp;<\/p>\n<p>You may also want to to <a href=\"https:\/\/kindsonthegenius.com\/blog\/basics-of-decision-theory-how-medical-diagnosis-apps-work\">read Decision Theory.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I assume you have a basic knowledge of Probability. For example, if there a 3 red ball and 2 blue balls in a bag and &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[414],"tags":[],"class_list":["post-1890","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=1890"}],"version-history":[{"count":1,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1890\/revisions"}],"predecessor-version":[{"id":2058,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/1890\/revisions\/2058"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=1890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=1890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=1890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}