#set document(title: "3.4 Probability Theory", author: "OpenStax / XYZ Homework") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 3.4#h(0.6em)Probability Theory === Learning Outcomes By the end of this section, you should be able to: - Describe the basic concepts of probability and apply these concepts to real-world applications in data science. - Apply conditional probability and Bayes’ Theorem. #strong[Probability] is a numerical measure that assesses the likelihood of occurrence of an event. Probability applications are ubiquitous in data science since many decisions in business, science, and engineering are based on probability considerations. We all use probability calculations every day as we decide, for instance, whether to take an umbrella to work, the optimal route for a morning commute, or the choice of a college major. === Basic Concepts of Probability We have all used probability in one way or another on a day-to-day basis. Before leaving the house, you might want to know the probability of rain. The probability of obtaining heads on one flip of a coin is one-half, or 0.5. A data scientist is in interested in expressing probability as a number between 0 and 1 (inclusive), where 0 indicates impossibility (the event will not occur) and 1 indicates certainty (the event will occur). The probability of an event falling between 0 and 1 reflects the degree of uncertainty associated with the event. Here is some terminology we will be using in probability-related analysis: - An #strong[outcome] is the result of a single trial in a probability experiment. - The #strong[sample space] is the set of all possible outcomes in a probability experiment. - An #strong[event] is some subset of the sample space. For example, an event could be rolling an even number on a six-sided die. This event corresponds to three outcomes, namely rolling a 2, 4, or 6 on the die. To calculate probabilities, we can use several approaches, including relative frequency probability, which is based on actual data, and theoretical probability, which is based on theoretical conditions. ==== Relative Frequency Probability #strong[Relative frequency probability] is a method of determining the likelihood of an event occurring based on the observed frequency of its occurrence in a given sample or population. A data scientist conducts or observes a procedure and determines the number of times a certain Event #math.equation(block: false, alt: "A")[$A$] occurs. The probability of Event #math.equation(block: false, alt: "A")[$A$], denoted as #math.equation(block: false, alt: "P open parenthesis A close parenthesis")[$P ( A )$], is then calculated based on data that has been collected from the experiment, as follows: #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals the fraction number of times Event A has occured over number of times the procedure was repeated")[$P ( A ) = frac("number of times Event " A " " "has occured", "number of times the procedure was repeated")$] #examplebox("Example 1")[][ A polling organization asks a sample of 400 people if they are in favor of increased funding for local schools; 312 of the respondents indicate they are in favor of increased funding. Calculate the probability that a randomly selected person will be in favor of increased funding for local schools. #solutionbox[ Using the data collected from this polling, a total of 400 people were asked the question, and 312 people were in favor of increased school funding. The probability for a randomly selected person being in favor of increased funding can then be calculated as follows (notice that Event #math.equation(block: false, alt: "A")[$A$] in this example corresponds to the event that a person is in favor of the increased funding): #math.equation(block: true, alt: "P ( A ), equals, Probability of In Favor; equals, the fraction number of times Event A has occurred over number of times the procedure was repeated equals the fraction 312 over 400 equals 0.78 equals 78 %")[$P "(" A ") " & = & " Probability of In Favor" \ & = & frac("number of times Event " A " has occurred", "number of times the procedure was repeated") = frac(312, 400) = 0.78 = 78 %$] ] ] #examplebox("Example 2")[][ A medical patient is told they need knee surgery, and they ask the doctor for an estimate of the probability of success for the surgical procedure. The doctor reviews data from the past two years and determines there were 200 such knee surgeries performed and 188 of them were successful. Based on this past data, the doctor calculates the probability of success for the knee surgery (notice that Event #math.equation(block: false, alt: "A")[$A$] in this example corresponds to the event that a patient has a successful knee surgery result). #solutionbox[ Using the data collected from the past two years, there were 200 surgeries performed, with 188 successes. The probability can then be calculated as: #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals Probability of Success equals the fraction number of times Event A has occured over number of times the procedure was repeated equals the fraction 188 over 200 equals 0.94")[$P ( A ) = "Probability of Success" = frac("number of times Event " A " has occured", "number of times the procedure was repeated") = frac(188, 200) = 0.94$] The doctor informs the patient that there is a 94% chance of success for the pending knee surgery. ] ] ==== Theoretical Probability #strong[Theoretical probability] is the method used when the outcomes in a #strong[probability experiment] are equally likely—that is, under theoretical conditions. The formula used for theoretical probability is similar to the formula used for #strong[empirical probability]. Theoretical probability considers all the possible outcomes for an experiment that are known ahead of time so that past data is not needed in the calculation for theoretical probability. #math.equation(block: true, alt: "Theoretical Probability equals the fraction number of outcomes for the event of interest over total number of outcomes in the sample space")[$"Theoretical Probability" #h(0.2em) = frac("number of outcomes for the event of interest", "total number of outcomes in the sample space")$] For example, the theoretical probability of rolling an even number when rolling a six-sided die is #math.equation(block: false, alt: "the fraction 3 over 6")[$frac(3, 6)$] (which is #math.equation(block: false, alt: "the fraction 1 over 2")[$frac(1, 2)$], or 0.5). There are 3 outcomes corresponding to rolling an even number, and there are 6 outcomes total in the sample space. Notice this calculation can be done without conducting any experiments since the outcomes are equally likely. #examplebox("Example 3")[][ A student is working on a multiple-choice question that has 5 possible answers. The student does not have any idea about the correct answer, so the student randomly guesses. What is the probability that the student selects the correct answer? #solutionbox[ Since the student is guessing, each answer choice is equally likely to be selected. There is 1 correct answer out of 5 possible choices. The probability of selecting the correct answer can be calculated as: #math.equation(block: true, alt: "Probability of Correct Answer, equals, the fraction number of outcomes for the event of interest over total number of outcomes in the sample space; equals, the fraction 1 over 5 equals 0.20 equals 20 %")[$"Probability of Correct Answer" & = & frac("number of outcomes for the event of interest", "total number of outcomes in the sample space") \ & = & frac(1, 5) = 0.20 = 20 %$] ] ] Notice in Example 3 that probabilities can be written as fractions, decimals, or percentages. Also note that any probability must be between 0 and 1 inclusive. An event with a probability of zero will never occur, and an event with a probability of 1 is certain to occur. A probability greater than 1 is not possible, and a negative probability is not possible. ==== Complement of an Event The #strong[complement of an event] is the set of all outcomes in the sample space that are #emph[not] included in the event. The complement of Event #math.equation(block: false, alt: "A")[$A$] is usually denoted by #math.equation(block: false, alt: "A ′")[$A ′$] (#strong[#emph[A] prime]). To find the probability of the complement of Event #math.equation(block: false, alt: "A")[$A$], subtract the probability of Event #math.equation(block: false, alt: "A")[$A$] from 1. #math.equation(block: true, alt: "P open parenthesis A ′ close parenthesis equals 1 minus P open parenthesis A close parenthesis")[$P ( A ′ ) = 1 − P ( A )$] #examplebox("Example 4")[][ A company estimates that the probability that an employee will provide confidential information to a hacker is 0.1%. Determine the probability that an employee will not provide any confidential information during a hacking attempt. #solutionbox[ Let Event #math.equation(block: false, alt: "A")[$A$] be the event that the employee will provide confidential information to a hacker. Then the complement of this Event #math.equation(block: false, alt: "A ′")[$A ′$] is the event that an employee will not provide any confidential information during a hacking attempt. #math.equation(block: true, alt: "P open parenthesis A ′ close parenthesis, equals, 1 minus P open parenthesis A close parenthesis; P open parenthesis A ′ close parenthesis, equals, 1 minus 0.001 equals 0.999")[$P ( A ′ ) & = & 1 − P ( A ) \ P ( A ′ ) & = & 1 − 0.001 = 0.999$] There is a 99.9% probability that an employee will not provide any confidential information during a hacking attempt. ] ] === Conditional Probability and Bayes’ Theorem Data scientists are often interested in determining conditional probabilities, or the occurrence of one event that is conditional or dependent on another event. For example, a medical researcher might be interested to know if an asthma diagnosis for a patient is dependent on the patient’s exposure to air pollutants. In addition, when calculating conditional probabilities, we can sometimes revise a probability estimate based on additional information that is obtained. As we’ll see in the following section, Bayes’ Theorem allows new information to be used to refine a probability estimate. ==== Conditional Probability A #strong[conditional probability] is the probability of an event given that another event has already occurred. The notation for conditional probability is #strong[#math.equation(block: false, alt: "P open parenthesis A | B close parenthesis")[$P ( A | B )$]], which denotes the probability of Event #math.equation(block: false, alt: "A")[$A$], given that Event #math.equation(block: false, alt: "B")[$B$] has occurred. The vertical line between #math.equation(block: false, alt: "A")[$A$] and #math.equation(block: false, alt: "B")[$B$] denotes the “given” condition. (In this notation, the vertical line does not denote division). For example, we might want to know the probability of a person getting a parking ticket given that a person did not put any money in a parking meter. Or a medical researcher might be interested in the probability of a patient developing heart disease given that the patient is a smoker. If the occurrence of one event affects the probability of occurrence for another event, we say that the events are #emph[dependent]; otherwise, the events are #emph[independent]. #strong[Dependent events] are events where the occurrence of one event affects the probability of occurrence of another event. #strong[Independent events] are events where the probability of occurrence of one event is #emph[not] affected by the occurrent of another event. The dependence of events has important implications in many fields such as marketing, engineering, psychology, and medicine. #examplebox("Example 5")[][ Determine if the two events are dependent or independent: + Rolling a 3 on one roll of a die, rolling a 4 on a second roll of a die + Obtaining heads on one flip of a coin and obtaining tails on a second flip of a coin + Selecting five basketball players from a professional basketball team and a player’s height is greater than 6 feet + Selecting an Ace from a deck of 52 cards, returning the card back to the original stack, and then selecting a King + Selecting an Ace from a deck of 52 cards, not returning the card back to the original stack, and then selecting a King #solutionbox[ + The result of one roll does not affect the result for the next roll, so these events are independent. + The results of one flip of the coin do not affect the results for any other flip of the coin, so these events are independent. + Typically, basketball players are tall individuals, and so they are more likely to have heights greater than 6 feet as opposed to the general public, so these events are dependent. + By selecting an Ace from a deck of 52 cards and then replacing the card, this restores the deck of cards to its original state, so the probability of selecting a King is not affected by the selection of the Ace. So these events are independent. + By selecting an Ace from a deck of 52 cards and then not replacing the card, this will result in only 51 cards remaining in the deck. Thus, the probability of selecting a King is affected by the selection of the Ace, so these events are dependent. ] ] There are several ways to use conditional probabilities in data science applications. Conditional probability can be defined as follows: #math.equation(block: true, alt: "P open parenthesis A | B close parenthesis equals the fraction P open parenthesis A and B close parenthesis over P open parenthesis B close parenthesis , where P open parenthesis B close parenthesis not equal to 0")[$P ( A | B ) = frac(P ( A "and" B ), P ( B )) , " where " P ( B ) ≠ 0$] When assessing the conditional probability of #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis")[$P ( A | B )$], if the two events are independent, this indicates that Event #math.equation(block: false, alt: "A")[$A$] is not affected by the occurrence of Event #math.equation(block: false, alt: "B")[$B$], so we can write that #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis equals P open parenthesis A close parenthesis")[$P ( A | B ) = P ( A )$] for independent events. If we determine that the #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis")[$P ( A | B )$] is not equal to #math.equation(block: false, alt: "P open parenthesis A close parenthesis")[$P ( A )$], this indicates that the events are dependent. #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis equals P open parenthesis A close parenthesis")[$P ( A | B ) = P ( A )$] implies independent events, where #math.equation(block: false, alt: "P open parenthesis B close parenthesis not equal to 0")[$P ( B ) ≠ 0$]. #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis not equal to P open parenthesis A close parenthesis")[$P ( A | B ) ≠ P ( A )$] implies dependent events. #examplebox("Example 6")[][ shows the number of nursing degrees and non-nursing degrees at a university for a specific year, and the data is broken out by age groups. Calculate the probability that a randomly chosen graduate obtained a nursing degree, given that the graduate is in the age group of 23 and older. #figure(table( columns: 4, align: left, inset: 6pt, table.header([#strong[Age Group]], [#strong[Nursing #linebreak() Degrees]], [#strong[Non-Nursing #linebreak() Degrees]], [#strong[Total]]), [22 and under], [1036], [1287], [2323], [23 and older], [986], [932], [1918], [#strong[Total]], [2022], [2219], [4241], )) #solutionbox[ Since we are given that the group of interest are those graduates in the age group of 23 and older, focus only on the second row in the table. Looking only at the second row in the table, we are interested in the probability that a randomly chosen graduate obtained a nursing degree. The reduced sample space consists of 1,918 graduates, and 986 of them received nursing degrees. So the probability can be calculated as: #math.equation(block: true, alt: "P (nursing degree | age group of 23 and older) equals the fraction 986 over 1,918 equals 0.514")[$P "(nursing degree | age group of 23 and older)" #h(0.2em) = frac(986, 1","918) = 0.514$] Another method to analyze this example is to rewrite the conditional probability using the equation for #math.equation(block: false, alt: "P open parenthesis A and B close parenthesis")[$P ( A " and " B )$], as follows: #math.equation(block: true, alt: "P open parenthesis A and B close parenthesis, equals, P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis; rewrite as: P open parenthesis B | A close parenthesis, equals, the fraction P open parenthesis A and B close parenthesis over P open parenthesis A close parenthesis")[$P ( A " and " B ) & = & P ( A ) · P ( B | A ) \ "rewrite as: " P ( B | A ) & = & frac(P ( A " and " B ), P ( A ))$] We can now use this equation to calculate the probability that a randomly chosen graduate obtained a nursing degree, given that the graduate is in the age group of 23 and older. The probability of #math.equation(block: false, alt: "A")[$A$] and #math.equation(block: false, alt: "B")[$B$] is the probability that a graduate received a nursing degree and is also in the age group of 23 and older. From the table, there are 986 graduates who earned a nursing degree and are also in the age group of 23 and older. Since this number of graduates is out of the total sample size of 4,241, we can write the probability of Events #math.equation(block: false, alt: "A")[$A$] and #math.equation(block: false, alt: "B")[$B$] as: #math.equation(block: true, alt: "P open parenthesis A and B close parenthesis equals the fraction 986 over 4,241")[$P ( A " and " B ) = frac(986, 4","241)$] We can also calculate the probability that a graduate is in the age group of 23 and older. From the table, there are 1,918 graduates in this age group out of the total sample size of 4,241, so we can write the probability for Event #math.equation(block: false, alt: "A")[$A$] as: #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals the fraction 1,918 over 4,241")[$P ( A ) = frac(1","918, 4","241)$] Next, we can substitute these probabilities into the formula for #math.equation(block: false, alt: "P open parenthesis B | A close parenthesis")[$P ( B | A )$], as follows: #math.equation(block: true, alt: "P open parenthesis B | A close parenthesis equals the fraction P open parenthesis A and B close parenthesis over P open parenthesis A close parenthesis equals the fraction the fraction 986 over 4,241 over the fraction 1,918 over 4,241 equals the fraction 986 over 4,241 times the fraction 4,241 over 1,918 equals the fraction 986 over 1,918 equals 0.514")[$P ( B | A ) = frac(P ( A " and " B ), P ( A )) = frac(frac(986, 4","241), frac(1","918, 4","241)) = frac(986, 4","241) · frac(4","241, 1","918) = frac(986, 1","918) = 0.514$] ] ] ==== Probability of #emph[At Least One] The probability of #strong[#emph[at least one occurrence]] of an event is often of interest in many data science applications. For example, a doctor might be interested to know the probability that at least one surgery to be performed this week will involve an infection of some type. The phrase “at least one” implies the condition of one or more successes. From a sample space perspective, one or more successes is the complement of “no successes.” Using the complement rule discussed earlier, we can write the following probability formula: #math.equation(block: true, alt: "P (at least one success) equals 1 minus P (no successes)")[$P "(at least one success)" #h(0.2em) = 1 − P "(no successes)"$] As an example, we can find the probability of rolling a die 3 times and obtaining at least one four on any of the rolls. This can be calculated by first finding the probability of not observing a four on any of the rolls and then subtracting this probability from 1. The probability of not observing a four on a roll of the die is 5/6. Thus, the probability of rolling a die 3 times and obtaining at least one four on any of the rolls is #math.equation(block: false, alt: "1 minus open parenthesis the fraction 5 over 6 close parenthesis cubed equals 0.421")[$1 − attach(( frac(5, 6) ), t: 3) = 0.421$]. #examplebox("Example 7")[][ From past data, hospital administrators determine the probability that a knee surgery will be successful is 0.89. + During a certain day, the hospital schedules four knee surgeries to be performed. Calculate the probability that all four of these surgeries will be successful. + Calculate the probability that none of these knee surgeries will be successful. + Calculate the probability that at least one of the knee surgeries will be successful. #solutionbox[ + For all four surgeries to be successful, we can interpret that as the first surgery will be successful, and the second surgery will be successful, and the third surgery will be successful, and the fourth surgery will be successful. Since the probability of success for one knee surgery does not affect the probability of success for another knee surgery, we can assume these events are independent. Based on this, the probability that all four surgeries will be successful can be calculated using the probability formula for #math.equation(block: false, alt: "P open parenthesis A and B close parenthesis")[$P ( A " and " B )$] by multiplying the probabilities together: #linebreak() #math.equation(block: true, alt: "P open parenthesis A and B and C and D close parenthesis, equals, P open parenthesis A close parenthesis times P open parenthesis B close parenthesis times P open parenthesis C close parenthesis times P open parenthesis D close parenthesis; equals, 0.89 times 0.89 times 0.89 times 0.89 equals 0.627")[$P ( A " and " B " and " C " and " D ) & = & P ( A ) · P ( B ) · P ( C ) · P ( D ) \ & = & 0.89 · 0.89 · 0.89 · 0.89 = 0.627$] #linebreak() There is about a 63% chance that all four knee surgeries will be successful. + The probability that a knee surgery will be unsuccessful can be calculated using the complement rule. If the probability of a successful surgery is 0.89, then the probability that the surgery will be unsuccessful is 0.11: #linebreak() #math.equation(block: true, alt: "P open parenthesis A ′ close parenthesis equals 1 minus P open parenthesis A close parenthesis equals 1 minus 0.89 equals 0.11")[$P ( A ′ ) = 1 − P ( A ) = 1 − 0.89 = 0.11$] #linebreak() Based on this, the probability that all four surgeries will be unsuccessful can be calculated using the probability formula for #math.equation(block: false, alt: "P open parenthesis A and B close parenthesis")[$P ( A "and" B )$] by multiplying the probabilities together: #linebreak() #math.equation(block: true, alt: "open parenthesis A ′ and B ′ and C ′ and D ′ close parenthesis, equals, P open parenthesis A ′ close parenthesis times P open parenthesis B ′ close parenthesis times P open parenthesis C ′ close parenthesis times P open parenthesis D ′ close parenthesis; equals, 0.11 times 0.11 times 0.11 times 0.11 equals 0.00015")[$( A ′ "and" B ′ "and" C ′ "and" D ′ ) & = & P ( A ′ ) · P ( B ′ ) · P ( C ′ ) · P ( D ′ ) \ & = & 0.11 · 0.11 · 0.11 · 0.11 = 0.00015$] #linebreak() Since this is a very small probability, it is very unlikely that none of the surgeries will be successful. + To calculate the probability that at least one of the knee surgeries will be successful, use the probability formula for “at least one,” which is calculated as the complement of the event “none are successful.” #linebreak() #math.equation(block: true, alt: "P (at least one success), equals, 1 minus P (no successes close parenthesis; P (at least one success), equals, 1 minus 0.00015 equals 0.99985")[$P "(at least one success)" & = & 1 − P "(no successes" #h(0.2em) \) \ P "(at least one success)" & = & 1 − 0.00015 = 0.99985$] #linebreak() This indicates there is a very high probability that at least one of the knee surgeries will be successful. ] ] ==== Bayes’ Theorem #strong[Bayes’ Theorem] is a statistical technique that allows for the revision of probability estimates based on new information or evidence that allows for more accurate and efficient decision-making in uncertain situations. Bayes’ Theorem is often used to help assess probabilities associated with medical diagnoses such as the probability a patient will develop cancer based on test screening results. This can be important in medical analysis to help assess the impact of a #emph[#strong[false positive]], which is the scenario where the patient does not have the ailment but the screening test gives a false indication that the patient does have the ailment. Bayes’ Theorem allows the calculation of the conditional probability #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis")[$P ( A | B )$]. There are several forms of Bayes’ Theorem, as shown: #math.equation(block: true, alt: "P open parenthesis A | B close parenthesis, equals, the fraction P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis over P open parenthesis B close parenthesis; P open parenthesis A | B close parenthesis, equals, the fraction P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis over P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis plus P open parenthesis A prime close parenthesis times P open parenthesis B | A prime close parenthesis")[$P ( A | B ) & = & frac(P ( A ) · P ( B | A ), P ( B )) \ P ( A | B ) & = & frac(P ( A ) · P ( B | A ), P ( A ) · P ( B | A ) + P ( A^(') ) · P ( B | A^(') ))$] #examplebox("Example 8")[][ Assume that a certain type of cancer affects 3% of the population. Call the event that a person has cancer “Event #math.equation(block: false, alt: "A")[$A$],” so: #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals 0.03")[$P ( A ) = 0.03$] A patient can undergo a screening test for this type of cancer. Assume the probability of a true positive from the screening test is 75%, which indicates that probability that a person has a positive test result given that they actually have cancer is 0.75. Also assume the probability of a false positive from the screening test is 15%, which indicates that probability that a person has a positive test result given that they do not have cancer is 0.15. A medical researcher is interested in calculating the probability that a patient actually has cancer given that the screening test shows a positive result. The researcher is interested in calculating #math.equation(block: false, alt: "P open parenthesis A | B close parenthesis")[$P ( A | B )$], where Event #math.equation(block: false, alt: "A")[$A$] is the person actually has cancer and Event #math.equation(block: false, alt: "B")[$B$] is the event that the person shows a positive result in the screening test. Use Bayes’ Theorem to calculate this conditional probability. #solutionbox[ From the example, the following probabilities are known: #math.equation(block: true, alt: "P open parenthesis A close parenthesis, equals, 0.03; P open parenthesis A ′ close parenthesis, equals, 0.97")[$P ( A ) & = & 0.03 \ P ( A ′ ) & = & 0.97$] The conditional probabilities can be interpreted as follows: #math.equation(block: true, alt: "P open parenthesis B | A close parenthesis, equals, P (positive test result | patient has cancer close parenthesis equals 0.75; P open parenthesis B | A ′ close parenthesis, equals, P (positive test result | patient does not have cancer) equals 0.15")[$P \( B | A \) & = & P "(positive test result |" "  patient has cancer" #h(0.2em) \) = 0.75 \ P \( B | A ′ \) & = & P "(positive test result |" " patient does not have cancer)" #h(0.2em) = 0.15$] Substituting these probabilities into the formula for Bayes’ Theorem results in the following: #math.equation(block: true, alt: "P open parenthesis A | B close parenthesis equals the fraction P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis over P open parenthesis A close parenthesis times P open parenthesis B | A close parenthesis plus P open parenthesis A prime close parenthesis times P open parenthesis B | A prime close parenthesis")[$P ( A | B ) = frac(P ( A ) · P ( B | A ), P ( A ) · P ( B | A ) + P ( A^(') ) · P ( B | A^(') ))$] #math.equation(block: true, alt: "P ( patient has cancer | positive test result) equals the fraction 0 . 03 times 0 . 75 over 0 . 03 times 0 . 75 plus 0 . 97 times 0 . 15 equals 0.134")[$P "( patient has cancer | positive test result)" #h(0.2em) = frac(0 . 03 · 0 . 75, 0 . 03 · 0 . 75 + 0 . 97 · 0 . 15) = 0.134$] This result from Bayes’ Theorem indicates that even if a patient receives a positive test result from the screening test, this does not imply a high likelihood that the patient has cancer. There is only a 13% chance that the patient has cancer given a positive test result from the screening test. ] ]