Chapter 8. A Brief Tour of Bayesian Statistics

In this chapter, we will take a brief tour of an alternative approach to statistical inference called Bayesian statistics. It is not intended to be a full primer but just serve as an introduction to the Bayesian approach. We will also explore the associated Python-related libraries, how to use pandas, and matplotlib to help with the data analysis. The various topics that will be discussed are as follows:

  • Introduction to Bayesian statistics
  • Mathematical framework for Bayesian statistics
  • Probability distributions
  • Bayesian versus Frequentist statistics
  • Introduction to PyMC and Monte Carlo simulation
  • Illustration of Bayesian inference – Switchpoint detection

Introduction to Bayesian statistics

The field of Bayesian statistics is built on the work of Reverend Thomas Bayes, an 18th century statistician, philosopher, and Presbyterian minister. His famous Bayes' theorem, which forms the theoretical underpinnings for Bayesian statistics, was published posthumously in 1763 as a solution to the problem of inverse probability. For more details on this topic, refer to http://en.wikipedia.org/wiki/Thomas_Bayes.

Inverse probability problems were all the rage in the early 18th century and were often formulated as follows:

Suppose you play a game with a friend. There are 10 green balls and 7 red balls in bag 1 and 4 green and 7 red balls in bag 2. Your friend turns away from your view, tosses a coin and picks a ball from one of the bags at random, and shows it to you. The ball is red. What is the probability that the ball was drawn from bag 1?

These problems are termed inverse probability problems because we are trying to estimate the probability of an event that has already occurred (which bag the ball was drawn from) in light of the subsequent event (that the ball is red).

Introduction to Bayesian statistics

Bayesian_balls_illustration

Let us quickly illustrate how one would go about solving the inverse probability problem illustrated earlier. We wish to calculate the probability that the ball was drawn from bag 1, given that it is red. This can be denoted as Introduction to Bayesian statistics.

Let us start by calculating the probability of selecting a red ball. This can be calculated by following the two paths in red as shown in the preceding figure. Hence, we have Introduction to Bayesian statistics.

Now, the probability of choosing a red ball from bag 1 is via the upper path only and is given as follows:

Introduction to Bayesian statistics

And, the probability of choosing a red ball from bag 2 is given as follows:

Introduction to Bayesian statistics

Note that this probability can be written as follows:

Introduction to Bayesian statistics

By inspection we can see that Introduction to Bayesian statistics, and the final branch of the tree is only traversed if the ball is firstly in bag 1 and is a red ball. Hence, intuitively we'll get the following outcome:

Introduction to Bayesian statistics
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.152