Bayes’ Theorem

Bayes’ Theorem formula, also known as Bayes’ Law, or Bayes’ Rule, is an intuitive idea. We adjust our perspective (the probability set) given new, relevant information. Formally, Bayes’ Theorem helps us move from an unconditional probability (what are the odds the economy will grow?) to a conditional probability (given new evidence, what are the odds the economy will grow?)

Suppose your daughter tells you that her friend is coming home tomorrow. Since you don’t know anything else, there is a 50% chance that the friend is a female. Now she tells you that her friend has long hair. With this additional information there are now more chances that the friend is a female. Bayes’ theorem can be applied in such scenarios to calculate the probability (probability that the friend is a female.)

A simple representation of Bayes’ formula is as follows:

Example 1

The following information is available regarding drug testing.

  • 0.5% of people are drug users
  • A test has 99% accuracy. 99% of drug users and 99% of non-drug users are correctly identified by it.

The problem question is to find the probability of being a drug user if you’ve tested positive?

The solution according to Baye’s theorem is as follows:

  • P(pos|user)=0.99 (99% effective at detecting users)
  • p(user)=0.005 the probability of a number of people being drug users
  • p(pos)=0.01*0.995+0.99*0.005 = 0.0149 which is deduced from the following details: 1% chance of non-users, 99.5% of the population, to be tested positive, plus 99% chance of the users, 0.5% of the population, to be tested positive.
  • P(user/pos) = 0.99*0.005/0.0149 = 0.33

The answer we arrive at is that there is only a 33% chance that a positive test is correct

In this example some information is available about the proportions of users versus non-users but in practice such information may not be available or determined.

Example 2

A company expects that there is a 5% probability that the economy will expand. Furthermore, there is a 90% probability that the company’s revenue will rise if the economy expands. If the economy does not expand, there is only 40% probability that company’s revenue will rise.

What is the probability that the economy has expanded given that the company’s revenue has risen.

We want to find out:

P (Economy Expansion | Company Revenue Rises) = P (EE | RR)

P(EE | RR) = P (RR | EE) * P(EE)/P(RR)

P (Economy Expansion) = P(EE) = 0.05

P (Revenue Rise | Economy Expansion) = P(RR | EE) = 0.90

P (Revenue Rise) = P(RR) = 0.05*0.90 + 0.95*0.40 = 0.425

P(EE | RR) = 0.90*0.05/0.425 = 0.106

If the company’s revenue has risen, then there is a 10.6% probability that the economy has expanded.

Related Downloads

Related Quizzes

Probablity Concepts

Data Science in Finance: 9-Book Bundle

Data Science in Finance Book Bundle

Master R and Python for financial data science with our comprehensive bundle of 9 ebooks.

What's Included:

  • Getting Started with R
  • R Programming for Data Science
  • Data Visualization with R
  • Financial Time Series Analysis with R
  • Quantitative Trading Strategies with R
  • Derivatives with R
  • Credit Risk Modelling With R
  • Python for Data Science
  • Machine Learning in Finance using Python

Each book includes PDFs, explanations, instructions, data files, and R code for all examples.

Get the Bundle for $39 (Regular $57)
JOIN 30,000 DATA PROFESSIONALS

Free Guides - Getting Started with R and Python

Enter your name and email address below and we will email you the guides for R programming and Python.

Data Science in Finance: 9-Book Bundle

Data Science in Finance Book Bundle

Master R and Python for financial data science with our comprehensive bundle of 9 ebooks.

What's Included:

  • Getting Started with R
  • R Programming for Data Science
  • Data Visualization with R
  • Financial Time Series Analysis with R
  • Quantitative Trading Strategies with R
  • Derivatives with R
  • Credit Risk Modelling With R
  • Python for Data Science
  • Machine Learning in Finance using Python

Each book comes with PDFs, detailed explanations, step-by-step instructions, data files, and complete downloadable R code for all examples.