ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Probability and Statistics
    MS-251
    Progress0 / 36 topics
    Topics
    1. Introduction: Statistics and Data Analysis2. Statistical Inference3. Samples, Populations, and the Role of Probability4. Sampling Procedures5. Discrete and Continuous Data6. Statistical Modeling7. Types of Statistical Studies8. Probability: Sample Space, Events, Counting Sample Points9. Probability of an Event10. Additive Rules11. Conditional Probability12. Independence and the Product Rule13. Bayes’ Rule14. Random Variables and Probability Distributions15. Mathematical Expectation: Mean of a Random Variable16. Variance and Covariance of Random Variables17. Means and Variances of Linear Combinations of Random Variables18. Chebyshev’s Theorem19. Discrete Probability Distributions20. Continuous Probability Distributions21. Fundamental Sampling Distributions22. Sampling Distributions and Data Descriptions23. Random Sampling24. Sampling Distributions25. Sampling Distribution of Means and the Central Limit Theorem26. Sampling Distribution of S227. t-Distribution28. F-Quantile and Probability Plots29. Single Sample & One- and Two-Sample Estimation Problems30. Single Sample & One- and Two-Sample Tests of Hypotheses31. The Use of P-Values for Decision Making in Testing Hypotheses32. Regression: Linear Regression and Correlation33. Least Squares and the Fitted Model34. Multiple Linear Regression and Certain Nonlinear Regression Models35. Linear Regression Model Using Matrices36. Properties of the Least Squares Estimators
    MS-251›Bayes’ Rule
    Probability and StatisticsTopic 13 of 36

    Bayes’ Rule

    11 minread
    1,919words
    Intermediatelevel

    Bayes' Rule

    Bayes' Rule is one of the most important and powerful concepts in probability theory and statistics. It allows you to update the probability of an event based on new evidence. The rule is named after the Reverend Thomas Bayes, an 18th-century statistician who introduced the concept of conditional probability.

    Bayes' Rule helps us to calculate posterior probabilities. In simple terms, it tells us how to revise our belief about an event (posterior probability) based on new data or evidence (likelihood), and it connects this to the initial belief (prior probability).

    Mathematical Formulation

    Bayes' Rule provides a way to compute the conditional probability P(A∣B)P(A \mid B)P(A∣B) of event AAA given that event BBB has occurred. It is written as:

    P(A∣B)=P(B∣A)P(A)P(B)P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}P(A∣B)=P(B)P(B∣A)P(A)​

    Where:

    • P(A∣B)P(A \mid B)P(A∣B) is the posterior probability: the probability of event AAA occurring given that BBB has occurred.
    • P(B∣A)P(B \mid A)P(B∣A) is the likelihood: the probability of observing event BBB given that event AAA has occurred.
    • P(A)P(A)P(A) is the prior probability: the initial probability of event AAA occurring before any new evidence is observed.
    • P(B)P(B)P(B) is the marginal likelihood or evidence: the total probability of event BBB occurring, which can be computed as: P(B)=P(A)⋅P(B∣A)+P(¬A)⋅P(B∣¬A)P(B) = P(A) \cdot P(B \mid A) + P(\neg A) \cdot P(B \mid \neg A)P(B)=P(A)⋅P(B∣A)+P(¬A)⋅P(B∣¬A) where ¬A\neg A¬A denotes the complement of event AAA (i.e., the event where AAA does not happen).

    Interpretation

    Bayes' Rule provides a way to update your probability estimate for event AAA based on new evidence BBB. Here’s a breakdown of each component:

    • Prior probability (P(A)P(A)P(A)) represents your initial belief or knowledge about event AAA before any new information is taken into account.
    • Likelihood (P(B∣A)P(B \mid A)P(B∣A)) tells you how likely the evidence BBB is, assuming that AAA is true.
    • Posterior probability (P(A∣B)P(A \mid B)P(A∣B)) is your updated belief about the probability of event AAA, given the evidence BBB.
    • Marginal likelihood (P(B)P(B)P(B)) normalizes the equation to ensure the probabilities sum to 1. It represents the total probability of observing BBB, taking into account all possible scenarios.

    Example: Medical Diagnosis

    One of the most common applications of Bayes' Rule is in medical testing or diagnostic problems, where we want to determine the probability of a patient having a certain disease given the results of a diagnostic test.

    Let's assume we have the following information:

    • Event AAA: A person has the disease.
    • Event BBB: The test result is positive (i.e., the test indicates the person has the disease).

    We want to calculate the probability that the person actually has the disease given a positive test result, i.e., P(A∣B)P(A \mid B)P(A∣B).

    We are given:

    • Prior probability (P(A)P(A)P(A)): The probability that the person has the disease before the test result is known. For example, let’s say the disease affects 1% of the population: P(A)=0.01P(A) = 0.01P(A)=0.01
    • Likelihood (P(B∣A)P(B \mid A)P(B∣A)): The probability of a positive test result given that the person actually has the disease. For example, the test is 95% accurate in detecting the disease: P(B∣A)=0.95P(B \mid A) = 0.95P(B∣A)=0.95
    • False positive rate (P(B∣¬A)P(B \mid \neg A)P(B∣¬A)): The probability of a positive test result given that the person does not have the disease. For example, the test is 5% likely to incorrectly identify a healthy person as diseased: P(B∣¬A)=0.05P(B \mid \neg A) = 0.05P(B∣¬A)=0.05
    • Prior probability of not having the disease (P(¬A)P(\neg A)P(¬A)): Since 1% of the population has the disease, 99% do not: P(¬A)=0.99P(\neg A) = 0.99P(¬A)=0.99

    To calculate P(A∣B)P(A \mid B)P(A∣B), the probability of having the disease given a positive test result, we use Bayes' Rule:

    P(A∣B)=P(B∣A)P(A)P(B)P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}P(A∣B)=P(B)P(B∣A)P(A)​

    First, we need to calculate P(B)P(B)P(B), the total probability of a positive test result. This is done using the law of total probability:

    P(B)=P(B∣A)P(A)+P(B∣¬A)P(¬A)P(B) = P(B \mid A) P(A) + P(B \mid \neg A) P(\neg A)P(B)=P(B∣A)P(A)+P(B∣¬A)P(¬A)

    Substituting the known values:

    P(B)=(0.95×0.01)+(0.05×0.99)=0.0095+0.0495=0.059P(B) = (0.95 \times 0.01) + (0.05 \times 0.99) = 0.0095 + 0.0495 = 0.059P(B)=(0.95×0.01)+(0.05×0.99)=0.0095+0.0495=0.059

    Now, applying Bayes' Rule:

    P(A∣B)=0.95×0.010.059=0.00950.059≈0.161P(A \mid B) = \frac{0.95 \times 0.01}{0.059} = \frac{0.0095}{0.059} \approx 0.161P(A∣B)=0.0590.95×0.01​=0.0590.0095​≈0.161

    Thus, the probability that the person actually has the disease, given that they tested positive, is approximately 16.1%.

    Why is This Result Surprising?

    At first glance, one might expect a very high probability that the person has the disease given a positive test result. However, despite the test's high accuracy (95% sensitivity), the actual probability of having the disease is relatively low due to the low prior probability (only 1% of the population has the disease) and the false positive rate (5%). Even with a positive test result, the test is more likely to be a false positive due to the low base rate of the disease.

    Generalizing Bayes’ Rule: Multiple Hypotheses

    Bayes' Rule can also be extended to more than two possible events. Suppose you have multiple hypotheses H1,H2,…,HnH_1, H_2, \dots, H_nH1​,H2​,…,Hn​, and you want to calculate the probability of each hypothesis HiH_iHi​ given the evidence BBB. Bayes' Rule in this case becomes:

    P(Hi∣B)=P(B∣Hi)P(Hi)∑j=1nP(B∣Hj)P(Hj)P(H_i \mid B) = \frac{P(B \mid H_i) P(H_i)}{\sum_{j=1}^{n} P(B \mid H_j) P(H_j)}P(Hi​∣B)=∑j=1n​P(B∣Hj​)P(Hj​)P(B∣Hi​)P(Hi​)​

    Where:

    • P(Hi∣B)P(H_i \mid B)P(Hi​∣B) is the posterior probability of hypothesis HiH_iHi​ given the evidence BBB.
    • P(B∣Hi)P(B \mid H_i)P(B∣Hi​) is the likelihood of observing BBB given hypothesis HiH_iHi​.
    • P(Hi)P(H_i)P(Hi​) is the prior probability of hypothesis HiH_iHi​.
    • The denominator normalizes the probabilities by summing over all possible hypotheses H1,H2,…,HnH_1, H_2, \dots, H_nH1​,H2​,…,Hn​.

    Summary of Key Concepts

    1. Bayes' Rule allows us to update our beliefs about an event (posterior probability) based on new evidence.
    2. The formula is: P(A∣B)=P(B∣A)P(A)P(B)P(A \mid B) = \frac{P(B \mid A) P(A)}{P(B)}P(A∣B)=P(B)P(B∣A)P(A)​ Where:
      • P(A∣B)P(A \mid B)P(A∣B) is the posterior probability.
      • P(B∣A)P(B \mid A)P(B∣A) is the likelihood.
      • P(A)P(A)P(A) is the prior probability.
      • P(B)P(B)P(B) is the marginal likelihood.
    3. Medical Diagnostics Example: Bayes' Rule can be used to calculate the probability of a person having a disease given a positive test result.
    4. Law of Total Probability is used to calculate P(B)P(B)P(B), the total probability of evidence BBB by considering all possible causes.
    5. Counterintuitive Results: Even with high test accuracy, the probability of having a disease may remain low if the prior probability is low.

    Bayes' Rule is widely used in fields such as statistics, machine learning, data science, and medical diagnostics. It provides a powerful framework for making decisions and updating beliefs based on new data.

    Previous topic 12
    Independence and the Product Rule
    Next topic 14
    Random Variables and Probability Distributions

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time11 min
      Word count1,919
      Code examples0
      DifficultyIntermediate