# Bayesian Thinking

*28 Aug 2024**01 Sep 2024*

## Bayes Theorem - the basics

Stephen Hawking said he was once told that the inclusion of each equation in his book would cut the number of interested readers by 50%. Nevertheless, this one isn’t hard to grasp though it might appear to be using slightly odd syntax if you haven’t seen how conditional probabilities are expressed.

**Bayes’ Theorem** is a fundamental concept in probability theory that helps us update the probability of a hypothesis based on new evidence. It can be mathematically expressed as:

\[ P(H|E) = \frac{P(E|H) \times P(H)}{P(E)} \]

The ‘|’ symbol represents conditional probability so (PA|B) can be read as ’the probability of A occurring *given* that B has occurred

Where:

P(H|E) is the

**posterior probability**: the probability of the hypothesis \( H \) given the evidence \( E \).P(H) is the

**prior probability**: the initial probability of the hypothesis before seeing the evidence.P(E|H) is the

**likelihood**: the probability of the evidence \( E \) given that the hypothesis \( H \) is true.\( P(E) \) is the

**marginal likelihood**or**evidence**: the total probability of the evidence under all possible hypotheses.

### Example: Cancer Test Scenario

Let’s illustrate Bayes’ Theorem with a scenario involving a medical test for cancer. Imagine we have a test for cancer and following figures apply:

**Prevalence of Cancer**: 1% of the population has cancer. So, P(Cancer) = 0.01.**Test Sensitivity**(True Positive Rate): 90% of people with cancer test positive. So, P(Positive Test| Cancer) = 0.9).**Test Specificity**(True Negative Rate): 95% of people without cancer test negative. So, P(Negative Test} | No Cancer) = 0.95.

You take the test, and the result is positive. What is the probability that you actually have cancer?

#### Step 1: Identify the Relevant Probabilities

P(Positive Test): The probability of a positive test result, regardless of whether the person has cancer or not.

P(No Cancer) = 1 - P(Cancer) = 0.99.

P(Positive Test} | No Cancer) = 1 - Specificity = 1 - 0.95 = 0.05 .

#### Step 2: Apply Bayes’ Theorem

Bayes’ Theorem for this scenario is:

\[ P(\text{Cancer} | \text{Positive Test}) = \frac{P(\text{Positive Test} | \text{Cancer}) \times P(\text{Cancer})}{P(\text{Positive Test})} \]

First, we need to calculate \( P(\text{Positive Test}) \), the total probability of a positive test result:

\[ P(\text{Positive Test}) = P(\text{Positive Test} | \text{Cancer}) \times P(\text{Cancer}) + P(\text{Positive Test} | \text{No Cancer}) \times P(\text{No Cancer}) \]

Substituting the known values:

\[ P(\text{Positive Test}) = (0.9 \times 0.01) + (0.05 \times 0.99) \]

\[ \implies P(\text{Positive Test}) = 0.009 + 0.0495 = 0.0585 \]

Now, substitute this into the Bayes’ Theorem formula:

\[ P(\text{Cancer} | \text{Positive Test}) = \frac{0.9 \times 0.01}{0.0585} \]

\[ \implies P(\text{Cancer} | \text{Positive Test}) = \frac{0.009}{0.0585} \approx 0.1538 \]

#### Result:

Despite the positive test result, the probability that you actually have cancer is only **15.38%**.

#### Interpretation:

This result often surprises maths students coming across Bayes’ for the first time. Even though the test is quite accurate (90% sensitivity and 95% specificity), the probability of having cancer given a positive test result is relatively low. This is because the prevalence of cancer in the population is very low (1%), and the false positive rate (5%) still leads to a significant number of false positives relative to true positives.

Bayes’ Theorem demonstrates how prior probabilities (like the prevalence of cancer) and the accuracy of tests combine to produce the final probability of actually having the condition after testing positive.

## Bayesian Thinking in Modern Epistemology

Epistemology, the study of knowledge and belief, has long grappled with questions of how we know what we know, how we should update our beliefs in light of new evidence, and what it means to hold a rational belief. In recent decades, Bayesian thinking has emerged as a powerful framework in addressing these questions, offering a probabilistic approach to epistemology that has gained significant traction in various domains.

Bayesian inference, rooted in Bayes’ Theorem, provides a method for updating the probability of a hypothesis as new evidence is encountered. Unlike classical statistics, which often deals in binary hypotheses (true or false), Bayesianism allows for degrees of belief, reflecting the inherent uncertainty in much of our reasoning about the world. This flexibility has made Bayesian thinking not only a cornerstone of modern epistemology but also a practical tool in fields as diverse as science, medicine, economics, and artificial intelligence. Here’s how it ties into modern epistemology:

**Belief Updating**:- In epistemology, beliefs about the world are constantly updated as new evidence is encountered. Bayesian thinking suggests that rational agents should update their beliefs in a way that is consistent with Bayes’ theorem. This approach provides a formal method for how evidence should influence belief, leading to a more systematic understanding of knowledge acquisition.

**Probabilistic Nature of Belief**:- Bayesian epistemology treats beliefs as degrees of confidence or credence rather than binary true/false propositions. This allows for a more nuanced understanding of belief, where different degrees of belief can be represented by probabilities. This aligns with how we often think about uncertainty in the real world.

**Prior Knowledge**:- The concept of prior probability in Bayesian thinking highlights the importance of existing knowledge or beliefs before new evidence is considered. In epistemology, this emphasizes that our current beliefs influence how we interpret new information. It challenges the idea of objective knowledge by showing how subjective prior beliefs can shape our understanding.

**Rational Decision-Making**:- Bayesian thinking also plays a role in decision theory, where it provides a framework for making rational decisions under uncertainty. In epistemology, this extends to how agents should choose between competing hypotheses or theories based on the available evidence and prior beliefs.

**The Problem of Induction**:- Bayesian epistemology offers a response to the classic problem of induction, which questions how we can justify inductive reasoning (drawing general conclusions from specific observations). By using Bayesian inference, we can justify inductive reasoning as a rational process of updating beliefs based on evidence, even though it doesn’t provide certainty.

**Skepticism and Fallibilism**:- Bayesian epistemology accommodates a form of fallibilism, the idea that our beliefs might always be subject to revision in light of new evidence. It also offers a response to skepticism by showing how rational belief updating can lead to justified beliefs, even if they are not certain.

### The Application of Bayesian Thinking

Bayesian reasoning has become a powerful tool across a wide array of disciplines, fundamentally altering how we approach problems of uncertainty and evidence.

#### 1. Science and Medicine

In science, Bayesian methods are increasingly used to assess the validity of hypotheses. Traditional statistical methods, such as null hypothesis significance testing (NHST), often fall short in contexts where evidence is complex or ambiguous. NHST’s reliance on p-values can lead to misleading conclusions, especially when dealing with small sample sizes or multiple comparisons.

Bayesian approaches, by contrast, allow researchers to incorporate prior knowledge into their analyses, providing a more nuanced interpretation of data. For instance, in clinical trials, Bayesian methods can dynamically update the probability of a treatment’s effectiveness as data accumulates, enabling more ethical decision-making regarding continuing or stopping a trial.

In medical diagnostics, Bayesian inference plays a crucial role in assessing the probability of a disease given a patient’s symptoms and test results. This approach helps account for false positives and negatives, leading to more accurate diagnoses.

#### 2. Economics and Decision Theory

In economics, Bayesian models are used to predict market behavior, assess risks, and make informed decisions under uncertainty. Traditional economic models often assume rational agents with perfect information—a notion that is increasingly seen as unrealistic. Bayesian models, by incorporating uncertainty and updating beliefs as new information emerges, offer a more flexible and realistic approach to understanding economic behavior.

Decision theory, too, has been revolutionized by Bayesian thinking. The concept of expected utility, which underpins many decision-making frameworks, aligns naturally with Bayesian inference. By evaluating the expected outcomes of different actions based on updated probabilities, decision-makers can make choices that better reflect the complexities of the real world.

#### 3. Artificial Intelligence and Machine Learning

Perhaps the most visible application of Bayesian thinking today is in the field of artificial intelligence (AI) and machine learning. Bayesian networks, which model probabilistic relationships between variables, are used in everything from speech recognition to medical diagnosis software. These networks allow machines to make predictions based on incomplete or uncertain data, a key challenge in AI.

Moreover, Bayesian methods are integral to machine learning algorithms, particularly in the context of model selection and hyperparameter tuning. Bayesian optimization, for instance, is used to find the best model parameters by treating the optimization process as a probabilistic problem, balancing exploration and exploitation.

### Strengths of Bayesian Thinking

Bayesian inference offers several distinct advantages, particularly in how it aligns with both human intuition and the complexities of real-world problems.

**Flexibility**: Bayesian methods are inherently flexible, allowing for the incorporation of prior knowledge, which can be particularly valuable in fields where data is scarce or costly to obtain.**Continuous Updating**: Unlike traditional statistical methods that often rely on a fixed data set, Bayesian inference naturally accommodates new data, allowing for continuous updating of beliefs.**Interpretability**: The probabilistic nature of Bayesian inference aligns well with how people naturally think about uncertainty. Probabilities as degrees of belief are often more intuitive and interpretable than binary decisions.**Rational Decision-Making**: By explicitly modeling uncertainty and incorporating prior knowledge, Bayesian methods provide a rational framework for decision-making under uncertainty, leading to more informed and potentially more ethical decisions.

### Weaknesses and Criticisms

Despite its strengths, Bayesian thinking is not without its criticisms and challenges.

**Subjectivity of Priors**: One of the most common criticisms of Bayesian inference is the subjectivity involved in choosing a prior. Since the prior represents an initial belief, different choices of priors can lead to different conclusions, raising concerns about the objectivity of Bayesian methods.**Computational Complexity**: Bayesian methods, particularly in complex models with large data sets, can be computationally intensive. The integration and optimization required for updating beliefs can be resource-heavy, making these methods less practical in some real-time applications.**Overfitting**: In machine learning, Bayesian methods can sometimes lead to overfitting, where the model becomes too closely aligned with the training data and fails to generalize to new data. This risk is particularly high when priors are no

### Bayesian Thinking and Modern Epistemology

By framing belief and knowledge in terms of probability, Bayesianism suggests an answer to the problem of induction: how we can justify beliefs about the future based on past experiences. In a Bayesian framework, beliefs are never absolute; they are always subject to revision in light of new evidence.

This perspective aligns well with the increasingly empirical and data-driven nature of modern epistemology. As knowledge becomes more quantifiable and evidence more abundant, Bayesian methods offer a structured way to handle this information, balancing prior knowledge with new data.

Moreover, Bayesianism challenges the traditional dichotomy between rational and irrational beliefs. In a Bayesian framework, the rationality of a belief is not determined by whether it is true or false but by how well it aligns with the evidence and how it updates in response to new information. This shift has profound implications for debates about rationality, skepticism, and the nature of belief.

### Conclusion

Bayesian thinking in modern epistemology provides a powerful framework for understanding how we should revise our beliefs in light of new evidence, how we handle uncertainty, and how prior knowledge influences our interpretation of new information. It has profound implications for rational decision-making and the philosophy of science, making Bayes’ theorem not just a statistical tool but a fundamental concept in understanding human knowledge and belief.